Boost logo

Boost :

Subject: Re: [boost] [variant2] documentation request
From: Peter Dimov (lists_at_[hidden])
Date: 2019-03-03 03:17:38


> Andrzej Krzemienski wrote:
>
> > For instance, the variant's move assignment will sometimes use T's move
> > assignment rather than move constructor when changing the variant's
> > type, as in the following example:
> >
> > https://wandbox.org/permlink/GDRyS54bpdLP7GVa
>
> Interesting.
>
> Since the destructors and the move assignments are trivial, this variant
> has a pseudo-trivial move constructor, that is, it does the equivalent of
> memcpy.
>
> This however doesn't quite match the specification.
>
> I need to look into the latest changes to std::variant to see how it
> handles triviality in this case.

Not surprisingly std::variant gets this correct and only trivially assigns
when trivially constructible too. Should be fixed in
https://github.com/pdimov/variant2/commit/fdfe9df167ea7a4356691c4c25dc14c1a92b15c7,
thanks.


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