|
|
|
|
|
by jcelerier
3031 days ago
|
|
> This avoids default-constructing all of the values inside of it, only to overwrite them with the new values you're copying in. I think that I saw a few benchmarks once showing that for primitive types such as int & such, it was actually more efficient to resize() ; only past 32 or 64 bytes structs did reserving' become more interesting. In any case, when nitpicking on this it's even better to use boost::vector which allows to do an uninitialized resize : http://www.boost.org/doc/libs/1_66_0/doc/html/container/exte.... |
|