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

Paolo Carlini paolo.carlini@oracle.com
Mon Dec 10 13:17:00 GMT 2012


Hi,

On 12/10/2012 02:00 PM, Pedro Larroy wrote:
> Hi
>
> I'm trying to compile with -D_GLIBCXX_DEBUG  and I get an error which
> doesn't happen without the previous macro
>
> There's an implementation of iterator inheriting privately from
> std::__debug::map<......>::iterator and calling for operator==
> operator== in the 'std::__debug::map<......>::iterator
>
> I get the following error:
>
> error: 'operator==' is not a member of 'std::__debug::map<......>::iterator
>
> Is operator== missing intentionally from the iterator class?
Please post a self-contained testcase exhibiting the problem. As a 
general principle, any kind of code compiling in normal mode is supposed 
to compile in debug-mode and the debug-mode iterator details are pretty 
old, thus I would be surprised if nobody noticed before such a 
macroscopic issue as operator== missing (and most likely we would see 
dozens of fails when running make check-debug) . Indeed something like 
this compiles fine in all the active branches with -D_GLIBCXX_DEBUG:

#include <map>

int main()
{
   std::map<int, int> m;

   auto it1 = m.begin();
   auto it2 = m.end();

   if (it1 == it2)
     ;
}

Note, just in case isn't obvious, that operator== is a *free* function, 
not a member function of the iterator class (both for normal mode and 
debug-mode iterator)

Paolo.



More information about the Libstdc++ mailing list