According to the C++ standard, is std::vector
ever allowed to reduce the capacity of the vector?
I am asking because I would like t
According to http://en.cppreference.com/w/cpp/container/vector/pop_back
No iterators or references except for
back()
andend()
are invalidated.
Therefore it may not reallocate. There is no C++11
tag on that page, which implies this is also true in 03. I will dig up the section references and edit them in for completeness.
Edit: Even better: From C++03
: [lib.container.requirements] (23.1), paragraph 10:
no
erase()
,pop_back()
orpop_front()
function throws an exception.
Same wording at 23.2.1/10 in N3337 (~C++11
).