/tr1/hashtable lines 1318-132 documents hashtable::erase(const_iterator i) It states:
"The return type should be const_iterator, and it should return the iterator following the one we've erased. That would simplify range erase." However, if erase would return an iterator, range-erase would not work the way the comment suggests. The comment (probably) refers to code like the following (attempting to erase values whose key is larger than 20): for(typename T::iterator i = t.begin(); i != t.end();) if(i->first > 20) i = t.erase(i); // (*) else ++i; This looks simple, but it probably won't work. The line marked by (*) might resize the container, which will rehash/reposition all values. The iterator i might point to values already accessed, or might have skipped passt values not yet accessed, or both. tr1 is correct: t.erase(i) cannot return any meaningful iterator. -- Summary: Documentation in /tr1/hashtable proposes possibly misleading change Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: atavory at gmail dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24061