
Daniel Krügler escribió:
joaquin@tid.es wrote:
Cannot you just resort to a manual for-loop like this?
multi_t mic; ... for(multi_t::iterator it=mic.begin(),it_end=mic.end();it!=it_end;){ if(pred(*it))it=mic.erase(it); else ++it; }
Btw.: Is this a documented feature that end() will not be invalidated by erase? Sorry, if this is a beginner's question, but I could not find such a statement in the docs (probably too blind).
Yes, see for instance in the case of ordered indices at http://tinyurl.com/5g5kd6 : "Except where noted, ordered indices [...] are models of Sorted Associative Container and Unique Associative Container, much as std::sets are. Accordingly, validity of iterators and references to elements is preserved." Similar statements are made for the rest of index types. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo