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]
Other format: [Raw text]

Re: operator== missing on std::__debug::map<>::iterator


On 10 December 2012 16:39, Pedro Larroy wrote:
> Hi Paolo
>
> What do you mean by doesn't exists? It exists in release mode in
> _Rb_tree_iterator class
>
>       bool
>       operator==(const _Self& __x) const
>       { return _M_node == __x._M_node; }
>
> But I think it doesn't exist in the debug map iterator class, as the
> compiler error shows.
>
> Shouldn't it be added to the debug map iterator class also so the code
> compiles in both release and debug modes?

No.  Your code make non-portable assumptions about the iterator type
and the debug mode has done you a favour by highlighting that error.
You should fix your code to only rely on the operations guaranteed to
work by the standard.

The standard says that if a and b are iterators of the same type then
a == b is a valid expression, it does not say that a.operator==(b) is
a valid expression.


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