std::vector<T> vec; // line #1
vec.reserve(100); // line #2
I am wondering if line #1 triggers a small allocation (say, memory for 10 Ts), or if the first allocation happens on line #2. Does the standard say anything about that?
It's implementation defined. The default-constructor for vector
does not need to allocate anything, but it's permissible for an implementation to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With