Boost logo

Boost :

Subject: Re: [boost] [variant2] documentation request
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2019-03-04 15:45:50


>> > 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.

You're thinking of modern code, or code you are permitted to change.

I'm thinking of code that I am not permitted to change, whose moves are
not noexcept because somebody forgot to mark them, and it's now written
into stone for the next five years. I face a raft of such code
regularly. I suspect I am not alone amongst Boost users.

You seem very wedded to not breaking out single_buffer_variant and
double_buffer_variant Peter. You seem keen we should accept your
preferred mix of when each ought to be employed using your hardcoded
logic. Can I ask why?

Niall


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