- assign
- clear
- erase (invalidates those after the erased element)
- insert
- pop_back (may or may not, I am not sure)
- push_back (if causes reallocation - may not when extra space for more elements reserved)
- resize
- reserve
- swap
- assignment operator=
- when the vector object is destroyed
All these are capable of causing reallocations of the vector and hence are capable of invalidating iterators. I will try to make it more simpler : anything that can change size() or capacity()! If there can be exceptions to this statement, please let me know!
Cheers!!!
No comments:
Post a Comment