1 Dec
2004
1 Dec
'04
4:11 p.m.
Jeff Flinn
A third solution?: (untested)
const_iterator_type wrapper::erase( const_iterator_type aItr ) { thismaptype::iterator lItr = thismap.find( aItr->first );
if( lItr == thismap.end() ) throw something;
return thismap.erase( lItr ); }
You are right, for a map this would be much better than the distance solution, but it is still basically the same problem: You are searching an element that you already know. For a map the overhead is not so big, for containers like list it really hurts. Thanks for your effort, Martin Wartens