What is the capacity()
of an std::vector
which is created using the default constuctor? I know that the size()
is zero. Can we state t
The standard doesn't specify what the initial capacity
of a container should be, so you're relying on the implementation. A common implementation will start the capacity at zero, but there's no guarantee. On the other hand there's no way to better your strategy of std::vector
so stick with it.