C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Halfway between 'variant' and 'any'

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Tue, 3 Jan 2023 08:21:13 +0000
On Tue, 3 Jan 2023, 07:38 Frederick Virchanza Gotham via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

>
> On Monday, January 2, 2023, Edward Catmur <ecatmur_at_[hidden]> wrote:
>
>>
>> You could accomplish the inplace part with an appropriate allocator.
>>
>
>
> If the allocator fails to allocate because the buffer is too small, then
> this problem can be detected at runtime and we can throw an exception. But
> with the classes I wrote, we can catch this at compile time either with
> 'static_assert' or a concept constraint.
>

Allocators are typed. Such an allocator just needs to refuse to rebind to a
T that is too large or too aligned.

Received on 2023-01-03 08:21:28