Boost logo

Boost :

Subject: Re: [boost] [variant2] Need rationale for never-empty guarantee
From: Gavin Lambert (boost_at_[hidden])
Date: 2019-03-04 22:11:03

On 4/03/2019 22:53, Niall Douglas wrote:
>> While I agree that switching to an apparently unrelated state is
>> surprising, it could be anticipated and "solved" by always using
>> monostate as the first type where the types might throw on move.  (And
>> perhaps variant could issue a warning or error if you try to do otherwise?)
> I'd much prefer that the code not compile instead of unrelated states
> magically appearing in corner case situations.
> Let the user add in monostate to the list of state options if they'd
> like to explicitly opt into monostate, and only monostate, magically
> appearing if there is no alternative in the single buffer variant
> implementation only.

Yes, that's essentially what I was suggesting.

Boost list run by bdawes at, gregod at, cpdaniel at, john at