The storage of the vector is handled automatically, being expanded and contracted as needed.
via cppreference
Can someone elaborate on the 'contracted' part? I thought a std::vector would always occupy the max capacity it reached even if we pop 99% of its elements, unless we call shrink_to_fit() explicitly or use the empty-swap idiom.