- Does vector::operator= change vector capacity? If so, how?
- Does vector's copy constructor copy capacity?
I looked through documentation but could not find a specific answer. Is it implementation dependent?
See Question&Answers more detail:osI looked through documentation but could not find a specific answer. Is it implementation dependent?
See Question&Answers more detail:osAll you're guaranteed is that:
So how much extra or little an implementation wants to put is up to the implementation. I think most will make capacity match size, when copying, but it cannot lower capacity. (Because of number 2 above; reallocating while there's enough room is not allowed.)
* Mostly. See Charles' comments below.