|
Boost : |
Subject: Re: [boost] [variant2] Andrzej's review -- documentation
From: Peter Dimov (pdimov_at_[hidden])
Date: 2019-04-07 03:33:00
Andrzej Krzemienski wrote:
> Consider the following example:
>
> ```
> struct X {};
>
> struct Guard {
> explicit Guard(int) {}
> Guard(Guard&&) = delete;
> };
>
> variant<X, Guard> v {};
> v.emplace<Guard>(1);
> ```
>
> This works fine with std::variant, but fails to compile with
> variant2::variant, because the latter requires all the alternative types,
> at least in one implementaiton of the never-empty trick, to be
> move-constructible. But this requirement is never listed in either global
> requirements for alternative types stored in variant, or in the
> specification of functions `emplace()`.
The documentation is correct, the implementation is wrong here; this should
work and the fact that it doesn't is a bug. Thanks.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk