rel_ops issues

Joe Buck jbuck@racerx.synopsys.com
Mon Apr 2 18:26:00 GMT 2001


Gaby writes:

> Again using std::rel_ops::operator!= even at function scope is *NOT*
> a fix -- it is just wrong.

Sorry, you have not yet convinced me.

> Consider what should happen with:
> 
> 	#include <stdio.h>
> 
> 	namespace Mine
> 	{
> 	   template<typename T>
> 	   bool operator==(const X<T>& a, const X<T>& b)
> 	   {
> 	      printf("%p == %p\n", &a, &b);
> 	      return true;
> 	   }
> 
> 	   template<typename  T>
> 	   bool operator!=(const X<T>& a, const X<T>& b)
>            {
>               printf("%p != %p\n", &a, &b);
> 	      return false;
>            }
> 
> 	   struct Y : X<int> { };
> 	}

So?

This is not a complete example.  Please show me where you put the using
directive, and which code malfunctions, remembering that because of the
way partial specialization works, bool operator!=(const X<T>& a, const
X<T>& b) will be chosen over the one in rel_ops (there is no ambiguity).




More information about the Libstdc++ mailing list