public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* stl_relops.h collision conflict
@ 2001-09-11  4:57 Olaf Petzold
  2001-09-11 10:26 ` Joe Buck
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Petzold @ 2001-09-11  4:57 UTC (permalink / raw)
  To: GCC Mailing List

Hello,

I'm writing an ET library. Unfortunally I'm gone into trouble
with the stl internal header stl_relops.h from gcc:

template <class _Tp>
inline bool operator>(const _Tp& __x, const _Tp& __y) {
  return __y < __x;
}

and my:

template<class T1, class T2, size_t Sz>
inline
Xpr<
  XprBinOp<
    VectorReference<T1, Sz>,
    Functional::Greater<T1, T2>,
    VectorReference<T2, Sz>
  >
>
operator>(const Vector<T1, Sz>& lhs, const Vector<T2, Sz>& rhs) {
  typedef XprBinOp<
    VectorReference<T1, Sz>,
    Functional::Greater<T1, T2>,
    VectorReference<T2, Sz>
    >                                                   expr_type;
  return Xpr<expr_type>(expr_type(lhs.ref(), rhs.ref()));
}

Is there no way to force the compiler to use my implementation of
operator>() ? 

On gcc-3.0.1 the relops header has an own inner namespace but, the problems
has been occoured in prior version as well. Is there a work around ?

Thanks
Olaf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: stl_relops.h collision conflict
  2001-09-11  4:57 stl_relops.h collision conflict Olaf Petzold
@ 2001-09-11 10:26 ` Joe Buck
  2001-09-12  2:42   ` Olaf Petzold
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Buck @ 2001-09-11 10:26 UTC (permalink / raw)
  To: Olaf Petzold; +Cc: GCC Mailing List

> I'm writing an ET library. Unfortunally I'm gone into trouble
> with the stl internal header stl_relops.h from gcc:

Please be specific about versions.

> template <class _Tp>
> inline bool operator>(const _Tp& __x, const _Tp& __y) {
>   return __y < __x;
> }

2.95.x, egcs, or "2.96".

> and my:
> 
[ templated operator> that does not return a bool ]

> Is there no way to force the compiler to use my implementation of
> operator>() ? 

For older gcc's, you might try explicitly instantiating the template.

> On gcc-3.0.1 the relops header has an own inner namespace but, the problems
> has been occoured in prior version as well. Is there a work around ?

In 3.0.x or other ISO standard C++ compiler, if you avoid importing
rel_ops with a using directive, you should have no problem.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: stl_relops.h collision conflict
  2001-09-11 10:26 ` Joe Buck
@ 2001-09-12  2:42   ` Olaf Petzold
  2001-09-12 12:50     ` Joe Buck
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Petzold @ 2001-09-12  2:42 UTC (permalink / raw)
  To: GCC Mailing List

Am Die, 11 Sep 2001 schrieben Sie:
> > I'm writing an ET library. Unfortunally I'm gone into trouble
> > with the stl internal header stl_relops.h from gcc:
> 
> Please be specific about versions.
> 
> > template <class _Tp>
> > inline bool operator>(const _Tp& __x, const _Tp& __y) {
> >   return __y < __x;
> > }
> 
> 2.95.x, egcs, or "2.96".
2.96 mandrake 8.0

> > On gcc-3.0.1 the relops header has an own inner namespace but, the problems
> > has been occoured in prior version as well. Is there a work around ?
> 
> In 3.0.x or other ISO standard C++ compiler, if you avoid importing
> rel_ops with a using directive, you should have no problem.
That's right, no problem on using it but, worse code. See inliner problems. I
haven't checked Kurt's patch v3 yet.

Regards
Olaf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: stl_relops.h collision conflict
  2001-09-12  2:42   ` Olaf Petzold
@ 2001-09-12 12:50     ` Joe Buck
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Buck @ 2001-09-12 12:50 UTC (permalink / raw)
  To: Olaf Petzold; +Cc: GCC Mailing List

[ conflicts with templated operator>()]

> > In 3.0.x or other ISO standard C++ compiler, if you avoid importing
> > rel_ops with a using directive, you should have no problem.
> That's right, no problem on using it but, worse code. See inliner problems. I
> haven't checked Kurt's patch v3 yet.

According to Gerald's tests 3.0.2 should be a lot better.  You can
help ensure that it is by testing it (from snapshots or CVS using
-rgcc-3_0-branch).

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-09-12 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-11  4:57 stl_relops.h collision conflict Olaf Petzold
2001-09-11 10:26 ` Joe Buck
2001-09-12  2:42   ` Olaf Petzold
2001-09-12 12:50     ` Joe Buck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).