Boost logo

Boost :

Subject: Re: [boost] [variant2] documentation request
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2019-03-04 09:55:13


>> This is why I would suggest variant2 provide elemental
>> single_buffer_variant and double_buffer_variant, and let the end user
>> choose which they want.
>
> variant2 presently is single_buffer_variant except that instead of
> giving you an error when that's not possible, it silently switches to
> double_buffer_variant and soldiers on. (Which happens rarely.)
>
> I agree that one can make a good argument for (a variation of)
> double_buffer_variant, which prioritizes strong guarantee over sizeof.
> But that's only needed when your contained types don't have noexcept
> move. In this case, a not unreasonable course of action is to hold them
> by unique_ptr in the variant instead.

Except I don't want to pay for the dynamic memory allocation.

>From my perspective, there is no downside to exposing directly to the
Boost user both single and double buffered implementations.

Let the Boost user decide what tradeoffs they prefer.

Niall


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