Boost logo

Boost :

Subject: Re: [boost] variant2 never empty guarantees (was: Re: Outcome/expected/etc/etc/etc)
From: Peter Dimov (lists_at_[hidden])
Date: 2017-06-14 17:10:56

Andrzej Krzemienski wrote:

> 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?

You can, it will double-buffer to keep emplace strong. Or you can use

All types nothrow move constructible -> single buffer;

Otherwise, first alternative is valueless -> single buffer;

Otherwise -> double buffer.

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