As I read that using containers' insert() or erase() method can invalidate the container and therefore it's better to not cache the end of a container using iterators before performing the insert () or erase() operation, I am confused about why only the last position of a container is invalidated but not the 1st one. (No advice is told in book that we should not cache an iterator referring the begin() of a container).
It may seem a dumb question but doesn't "invalidate" mean a total change of addresses for elements in the container? How can we be sure that the address of beginning of container remains always the same?