c++ - Does insertion to STL map invalidate other existing iterator? -
i used std::map in stl. can use iterator after other element inserted map? still valid?
when in doubt semantics of operation on container, consult the documentation:
map has important property inserting new element
mapnot invalidate iterators point existing elements.erasing element
mapnot invalidate iterators, except, of course, iterators point element being erased.
this taken sgi stl documentation. while documentation technically not specify behavior of c++ standard library containers, differences insignificant, aside parts of stl not part of c++ standard library, of course.
the sgi stl documentation indispensable reference, if don't have copy of c++ standard.
Comments
Post a Comment