Does a pointer become invalidated if an iterator is invalidated in STL containers
问题 I am trying to understand the concept of iterator invalidation in vectors. From some of the reading I have done I have found that if a vector contains say 7 elements and you delete the element on the 5th index then the iterators from 5th element onwards become invalidated. This is because all the elements after the 5th index would need to move up one slot. This makes sense to me however I am a bit confused between the following two cases std::vector<foo> vec {foo{1},foo{2}}; //foo is a simple