Boost logo

Boost :

From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2020-01-23 16:47:48


W dniu 23.01.2020 o 14:36, degski via Boost pisze:
> On Thu, 23 Jan 2020 at 07:33, degski <degski_at_[hidden]> wrote:
>
>> On Thu, 23 Jan 2020 at 04:05, Richard Hodges via Boost <
>> boost_at_[hidden]> wrote:
>>
>>> On Thu, 23 Jan 2020 at 05:04, Christian Mazakas via Boost <
>>> boost_at_[hidden]> wrote:
>>>
>>>> I've been working on an AllocatorAwareContainer called `dynamic_array`
>>> and
>>>> was wondering if there'd be any interest in including it in Boost.
>>>>
>>> I've seen recent talk on the need for a fixed_capacity_vector in the
>>> cpplang slack. This looks at first glance like it might fit the bill.
>>>
>> AFAIK, https://github.com/gnzlbg/static_vector is already on it's way for
>> the std [P0843r3 ](https://gnzlbg.github.io/static_vector/), it does not
>> seem a good idea to do a rewrite, without reference to the std [of
>> `std::static_vector`, Vinnie :-), bikeshedding in the paper] being
>> developed and to do a rewrite at all. As is, it does not work on Windows,
>> due to calls to gcc/Clang built-in's, but that would be easy to fix.
>>
> Oh, yes, forgot one of the most attractive feature, it is fully
> `constexpr`, i.e. it forms a basis to create any compile time flat
> [associative] container.
>
> degski

AFAIU static_vector is a different container.

static_vector has compile-time max size, has semantics of std::vector,
contains the buffer of elements and therefore has O(N) move which copies
elements if they does not support move semantics.

dynamic_array has run-time size, has semantics of std::array, contains
pointer to dynamically allocated on the heap buffer of elements and
therefore has O(1) move.

Adam


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk