Boost logo

Boost :

Subject: Re: [boost] [variant2] documentation request
From: Peter Dimov (lists_at_[hidden])
Date: 2019-03-04 15:33:44


Niall Douglas wrote:
> > 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.

Types that don't have noexcept move typically already allocate. Yes, it's an
extra allocation, but going from 1 to 2 is not the same as going from 0 to
1.


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