Tuesday, 27 August 2013

What does the standard say about how calling clear on a vector changes the capacity?

What does the standard say about how calling clear on a vector changes the
capacity?

This website implies that clearing a vector MAY change the capacity:
http://en.cppreference.com/w/cpp/container/vector/clear
"Many implementations will not release allocated memory after a call to
clear(), effectively leaving the capacity() of the vector unchanged."
But according to @JamesKanze this is wrong and the standard mandates that
clear will not change capacity.
What does the standard say?

No comments:

Post a Comment