|
Boost : |
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2020-01-24 12:21:10
On Friday, January 24, 2020, Alexander Grund wrote:
>
> Currently there is:
>
> - Heap storage, resizable: vector
> - Stack storage, resizable: static_vector
> - Heap storage, fixed size at runtime: dynamic_array
> - Stack storage, fixed size at compiletime: array
> - Heap storage, fixed size at compiletime: unique_ptr<array>
>
> If you're fine with unique_ptr and most people are, you also have:
Heap storage, fixed size at runtime:
allocate_unique<T[]>(alloc, size, ...)
Gives users everything they need for buffers. (They don't need a Container
that is copyable).
And for for:
Heap storage, fixed size at compiletime:
allocate_unique<T[N]>(alloc, ...)
Saves bytes on storing size. It's better than unique_ptr<array<T, N>>
because it supports arrays-of-arrays:
allocate_unique<T[N][M][O]>(alloc, ...)
allocate_unique<T[][M][O]>(alloc, size, ...)
This facility shipped with Boost 1.72.
Glen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk