This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: c++/2405: "using std::rel_ops" blows up std::vector


OK, I think that I know how to fix this one.  Note that c++/847 is
related.

The issue is that if we have

using std::rel_ops;

then neither of operator!=(const _Tp&, const _Tp&)

nor operator!=(const std::__normal_iterator<_IteratorL, _C>&,
	       const std::__normal_iterator<_IteratorR, _C>&)

is considered better.  But what if we break the tie?

I tried adding a definition for
	operator!=(const std::__normal_iterator<_Iterator, _C>&,
		   const std::__normal_iterator<_Iterator, _C>&)

The difference is that both arguments must be equal, and both
must be a __normal_iterator.  We no longer have a tie, and the
test case works (it's not a tie because it is a strictly better
match).

The new definitions should be added to stl_iterator.h, not only for
operator!= but also for the other operators.




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