3 Mar
2019
3 Mar
'19
3:17 a.m.
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:
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/fdfe9df167ea7a4356691c4c25dc14c1a9..., thanks.