Boost logo

Boost :

Subject: Re: [boost] [variant] Heads-up!
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2019-04-29 19:05:40

On 4/29/19 9:04 PM, Antony Polukhin via Boost wrote:
> пн, 29 апр. 2019 г. в 20:44, Steven Watanabe via Boost <boost_at_[hidden]>:
>> On 4/29/19 11:30 AM, Antony Polukhin via Boost wrote:
>>> I've merged a very cool optimization by Nikita Kniazev into the master
>>> branch. From now on boost::variant does pointer stealing for recursive
>>> variants.
>>> This significantly improves the performance of the variants move constructors.
>>> However if you use a variant variable after the std::move for anything
>>> except destruction and assignment then you're getting an UB. Beware!
>> boost::variant goes to great lengths to prevent
>> exactly this situation. You just broke it. This
>> change is unacceptable. Please revert it. This
>> optimization can be used iff. you have a way to
>> construct a valid object in the rhs.
> You can restore the old slow pre-rvalue era behavior by defining

I would prefer to avoid config macros, especially if they affect ABI or
can cause ODR issues.

I have to agree with Steven. Never empty guarantee is a crucial
difference between Boost.Variant and std::variant. Its consequences may
be unfortunate for the move support, but that is that and one has to
bite the bullet if he wants the guarantee. If you want something else -
use a different variant.

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