|
Boost : |
Subject: Re: [boost] variant2 never empty guarantees (was: Re: Outcome/expected/etc/etc/etc)
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-06-08 13:22:07
2017-06-08 15:01 GMT+02:00 Peter Dimov via Boost <boost_at_[hidden]>:
> Gottlob Frege wrote:
>>
>> > Agreed. But I don't see much value in the never-empty guarantee if it
>> > doesn't give you the strong guarantee.
>>
>> I'm not sure I understand this fully; could you please explain from what
>> expressions, and under what conditions, you expect the strong guarantee?
>>
>> variant<X, Y> v1, v2;
>> X x;
>>
>> v1= v2; // do you expect strong guarantee here?
>> v1 = std::move(v2); // here?
>> v1 = x; // here?
>> v1 = std::move(x); // here?
>> v1.emplace<X>(); // here?
>>
>
> Anyone? This is a genuine inquiry. How can I give you strong guarantee if
> you don't tell me when and where you want it?
>
Maybe nobody needs the strong guarantee? This is definitely the case for my
programs. I put variants in different containers. But if exception is
thrown while modifying them I am destroying the entire data structure. I do
not need the previous state. If I cannot put the new one, I cannot proceed
anyway.
(I am not saying such guarantee is useless. I just observe that the need
occurred in my programs.)
Regards,
&rzej;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk