|
Boost : |
Subject: Re: [boost] static_vector using aligned_storage
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2012-12-13 07:54:55
Nevin Liber wrote:
> On 12 December 2012 18:30, Marshall Clow <mclow.lists_at_[hidden]> wrote:
>
>> On Dec 12, 2012, at 3:26 PM, Olaf van der Spek <ml_at_[hidden]> wrote:
>>
>>> On Wed, Dec 12, 2012 at 11:57 PM, Nevin Liber <nevin_at_[hidden]>
>> wrote:
>>>> static_vector<T, N, A = std::allocator<T>>
>>>>
>>>> And you could provide null_allocator_assert and null_allocator_throw as
>>>> options (or make one of those the default), as it is now the
>> responsibility
>>>> of the allocator, not static_vector, to throw or not throw.
>>
>> To me, that's a different container.
>>
>
> Why? How is it behaviorally any different, assuming you give it a
> null_allocator?
>
I agree with Marshall. You can understand 'hybrid' in at least two ways.
As I understand it hybrid_vector would have some static storage and
allocate new memory only if the number of elements is too big.
If Alloc parameter were used then your implementation of a static_vector
could become a simple static_vector or a hybrid_vector (or a vector
depends on implementation). This kind of container may be simply
implemented on top of those containers. What is more, probably only the
minority of users will find a use case for it. And the rest will just
take a simple static_vector and build a container they need.
Regards,
Adam
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk