I would like to "keep trace" of the "last used" element in a STL container, and I would like to understand what I should expect if the container change (an element is added/removed/changed) and how I can "mark" that the iterator is not "valid".
In particular my plan is, as soon as I create the STL container:
1 2
std::map<A,B> mycont;
std::map<A,B>::const_iterator iter = mycont.end() //to mark an "invalid" state
1) When elements are added, is iter still pointing to the "real end" of the the container or now is the "end" changed?
2) When I assign the iterator to a specific element, and another element is added, is iter still pointing to the same element?