As per default (http://www.cplusplus.com/reference/vector/vector/resize/) resize()
on a vector will call the default constructor.
Suppose I call push_back()
on a vector and it resizes due to that - will it then also initialize the newly allocated space? If so - why? Leaving things uninitialized first could be efficient if the client calls for example push_back()
because then one could simply copy the object as a whole instead of having to use the copy constructor as it would be the case if the memory location would already have been initialized.