All operations that modify the vector invalidates all iterators and references to its elements. Never keep references, iterators or pointers to elements. Indices may sometimes be used instead, but even indices are invalidated by insert() and remove(), as well as shrinking resize().