tr1::hashtable iterators

Peter Doerfler gcc@pdoerfler.com
Wed May 10 13:37:00 GMT 2006


Hi.

Trying to compile the following with either SuSE's 4.0.2 or SVN trunk
rev. 113521

=======================================

std::tr1::unordered_map<int,int>::iterator it;

=======================================

I found that the Internal::hastable_iterator and 
Internal::hashtable_const_iterator don't have default ctors which seems 
strange to me. I couldn't find a PR about this issue.

The proposal n1456 only says that the iterators have to be forward 
iterators. I don't know whether forward iterators have to be default 
constructible but it seems unexpected to me if they don't.

I'm not sure whether this is the correct fix, but adding

hashtable_iterator()
: hashtable_iterator_base<Value, cache>(0, 0) { }

and the same for hashtable_const_iterator seems to work for me, i.e. it 
compiles. I haven't done any further testing, yet.

Should I file a PR about this or is the current behavior correct?


Best regards,
Peter



More information about the Libstdc++ mailing list