http://www.martinbroadhurst.com/iterator-invalidation-rules-for-c-containers.html has concise explanations. Specifically,
- list insertions don’t invalidate any iterator. I feel iterator is a pointer to a node.
- tree insertions don’t invalidate any iterator. Same reason as list.
- for erasure from lists or trees, only the iterator to the erased node is invalidated.
Now for vector:
- vector insertion invalidates any iterator positioned somewhere after the insertion point. If reallocation happens due to exceeding vector.capacity() then all invalidated