Boost logo

Boost :

Subject: Re: [boost] [outcome] To variant, or not to variant?
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-06-02 07:50:20


2017-06-01 19:43 GMT+02:00 Robert Ramey via Boost <boost_at_[hidden]>:

> On 6/1/17 10:24 AM, Vicente J. Botet Escriba via Boost wrote:
>
>> The problem is that we don't have a never-empty variant in Boost (we have
>> Boost.Variant, but it uses double buffer IIRC).
>> Vicente
>>
>
> Right - so isn't variant the place to "fix" it? if outcome, expected,
> optional ... need a never-empty guarantee, should variant (std, boost,
> whatever) have that guarantee as well? Shouldn't these discussions take
> place in the context of variant?
>

outcome, expected, optional -- they all have a nice property, they always
have at least one type that is no-throw upon copy/move
constructor/assignment. Under these constraints it is easy to implement a
variant with strong assignment.

But generic variant needs to work on generic Ts, and cannot make this
assumption. If we provided a second variant, with stricter assumptions, or
added a specialization to the current one, it would work, I guess.

Regards,
&rzej;


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