c++/2405: "using std::rel_ops" blows up std::vector
Joe Buck
jbuck@racerx.synopsys.com
Sun Apr 1 00:00:00 GMT 2001
The following reply was made to PR c++/2405; it has been noted by GNATS.
From: Joe Buck <jbuck@racerx.synopsys.com>
To: gcc-gnats@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org
Subject: Re: c++/2405: "using std::rel_ops" blows up std::vector
Date: Tue, 27 Mar 2001 16:05:25 -0800 (PST)
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.
More information about the Gcc-prs
mailing list