4 Oct
2017
4 Oct
'17
9:47 p.m.
My biggest peeve is std::vector. I absolutely hate that it can ever allocate new storage on its own.
In my preferred STL2 design, a vector would only ever occupy its capacity which is given to it at the time of construction. It cannot change its capacity at all. You the programmer can, of course, create a new vector of larger capacity and have all the contents from the old vector moved/copied into the new vector.
How is this not avoided using reserve()?