Boost logo

Boost :

From: Gavin Lambert (boost_at_[hidden])
Date: 2020-01-29 03:51:41


On 25/01/2020 01:21, Glen Fernandes wrote:
> 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).

Not quite. These keep the storage pointer and the storage size
separately, so you still need a wrapper type (such as the Asio buffer
types), or to keep passing them around separately (which is error-prone)
or to make assumptions instead of passing it around (which is very
error-prone).

C++20 introduces std::span, which is a good way of passing around a
pointer and size together -- but it's non-owning, so still isn't a
solution for the above.


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