29 Jan
2020
29 Jan
'20
3:51 a.m.
On 25/01/2020 01:21, Glen Fernandes wrote:
Heap storage, fixed size at runtime: allocate_unique
(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.