I know that when using push_back() on a vector, it is possible that that vector will be re-allocated (if there is no space left) to have more space. When using pop_back(), can the vector be re-allocated, in order to free unused space?
In general, can I somehow ensure my vector is not re-allocated (assuming I know its max capacity), when using a sequence of push_back() and pop_back() operations? This re-allocation invalidates my pointers and iterators and causes problems.