c++ - Why doesn't std::vector::resize() deallocate the memory when you want to reduce the size of the vector? -
I do not understand why I use std :: vector :: swap ()
Why >
wants to reduce the size of any vector
and delete the vector
memory on it at the same time all the other unused Allocate to memory?
Reducing the capability of a vector
None of these are free. Actually he has the cost of shrinking vector, and it is not clear whether the users should give it by default.
Comments
Post a Comment