Boost logo

Boost :

Subject: Re: [boost] [variant] Heads-up!
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2019-04-29 18:08:39


AMDG

On 4/29/19 12:04 PM, Antony Polukhin 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
> BOOST_VARIANT_NO_RECURSIVE_WRAPPER_POINTER_STEALING.
>

That doesn't make it okay. Look, this optimization
would be fine with a different variant, one that doesn't
provide the never-empty guarantee. That isn't boost::variant.
This isn't some simple optimization. It's a major breaking
interface change.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk