Does resize() to a smaller size discard the reservation made by earlier reserve()?
c++, containers, std, vector
Solution
`vector<T>::resize(0)` should not cause a reallocation or deletion of allocated memory, and for this reason in most cases is preferable to `vector<T>::clear()`.
For more detail see answers to this question: std::vector resize downward
Problem
So if I reserve(100) first, add some elements, and then resize(0) (or any other number smaller than the current size), will the vector reallocate memory to a take less space than 100 elements?