Boost logo

Boost :

Subject: Re: [boost] [variant] Heads-up!
From: Nikita Kniazev (nok.raven_at_[hidden])
Date: 2019-04-29 20:07:43

There seems to be misunderstanding of what the thread is about.

The short sum-up of the changes: Nothing changed for users that does not
use recursive variant. The changes were applied mainly for
recursive_wrapper, and affect recursive variant indirectly.

The PR was proposed as a solution for two major recursive variant problems:
* Move-only types support
* Poor move performance (because of this one Spirit has its own variant)

Most of the users are not affected by recursive_wrapper move constructor
change. To hit it you have to visit (either directly, or with applying
comparison operators) a recursive moved-out variant.

> have to agree with Steven. Never empty guarantee is a crucial difference
between Boost.Variant and std::variant.

std::variant has no recursive variant support. In the common field nothing
changed. See the comment above.

> If the one negative is adding UB to valid existing code at the next point
release, doesn't that outweigh any number of positive outcomes?

I do not think there even a single user that visits moved-out variants.
There is an assertation for such usage though.

> Why wouldn't this be an opt-in strategy - this property of moves has been
established for years now.

Because it solves the bigger problems and for much more users that it
potentially breaks.

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