Subject: Re: [boost] variant2 never empty guarantees (was: Re: Outcome/expected/etc/etc/etc)
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-06-14 16:28:18
2017-06-14 18:21 GMT+02:00 Peter Dimov via Boost <boost_at_[hidden]>:
> Andrzej Krzemienski wrote:
> If you are not doing double buffering, how can you guarantee that
>> `emplace` is strong? You move the original to the side?
> I could do that, but I construct on the side instead and move it into
> place. This is another instance where people may disagree because emplace
> should as a principle always construct in-place. But realistically,
> construct on the side + move is never inferior to move original to the
> side, construct in-place, optionally move original back if constructor
Given that you have to move something anyway, I guess you are right.
Now I realize this all means the types inside variant need to be movable.
This will not be a problem in most of the cases, but does it mean I cannot
use variant2 with non-movable types?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk