|
Boost : |
Subject: Re: [boost] [container] varray aka static_vector
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-02-12 10:10:54
2013/2/12 Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]>
> Nevin Liber wrote:
>
>> On 11 February 2013 14:32, Krzysztof Czainski <1czajnik_at_[hidden]> 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk