This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: rel_ops issues


Joe Buck <jbuck@racerx.synopsys.com> writes:

[...]

| There are two possible fixes.  One is to add
| 
| 	using std::rel_ops::operator!=;
| 
| to the body of the function, ignoring Gaby's anguished screams. :-)

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

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> { };
	}

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]