Actually you'd have to try harder: even this might leave the current capacity unchanged. The blessed idiom is vec.swap(std::vector<T>()); c++11 added shrink_to_fit which is a non binding request to reduce capacity.
Actually you'd have to try harder: even this might leave the current capacity unchanged. The blessed idiom is vec.swap(std::vector<T>()); c++11 added shrink_to_fit which is a non binding request to reduce capacity.