Boost logo

Boost :

Subject: Re: [boost] variant2 never empty guarantees (was: Re: Outcome/expected/etc/etc/etc)
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-06-14 15:08:35

2017-06-14 15:27 GMT+02:00 Peter Dimov via Boost <boost_at_[hidden]>:

> Andrzej Krzemienski wrote:
> So, you mean -- unless I am using the special "valueless" type -- all
>> assignments/emplacements/swaps are strong (possibly at the expense of
>> double buffering in some cases)? That is, there is no "get C upon
>> unsuccessful assignment of A to B"?
> The only situation in which you get a C is when C is the special
> `valueless` type, yes.

This makes sense. If I ask for it, I get it.

> This does not mean that all assignments are strong. In
> variant<vector<string>> v1, v2;
> v1 = v2;
> the assignment is basic, because that's the guarantee
> vector<string>::operator= gives.

Interesting. This satisfies the expectation that a number of people have
expressed. But on the other hand, now that you are doing the double
buffering anyway, making the assignment strong would come almost fo free.

If we continue the example with projections: if I change from the drop down
menu from one mesh projection to another mesh projection, they are
different projections, but can be encoded in the same type; maybe we should
get the strong guarantee. If not in the assignment, then perhaps in a
dedicated function.


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