
2013/2/12 Adam Wulkiewicz <adam.wulkiewicz@gmail.com>
Nevin Liber wrote:
On 11 February 2013 14:32, Krzysztof Czainski <1czajnik@gmail.com> wrote:
Now that I think of it, I wish there was a way to push an element to the
back of varray without zero-initializing it (for PODs). But I think emplace_back should be consistent with other containers, so maybe some new member function can be added for this?
FYI: You can with the standard containers by using an allocator with a different method for construct.
If the library is written in C++11 or like Boost.Container emulates some mechanisms, in-place construction in allocator_traits in this case.
Thank you, Adam and Nevin for these insights, I'll definitely try one of the above allocator::construct tricks when it turns out I need to optimize my code further. However, I'd rather there was a new member function for "noinit" pushing/resizing. Just like the emplace* family of functions was added, while the push* family was left alone ;-) Cheers, Kris