etl/include
Roland Reichwein 0e01c812ea
Fix variant copy operations enabled with non-copyable alternatives (#1514)
etl::variant was copy-constructible and copy-assignable even when an
alternative was not copyable, and copying a non-copyable active
alternative silently copied only the index, leaving the variant in an
invalid state.

Move the copy/move construct and assign logic into variant_base and add
a variant_copy_move_control mixin that conditionally deletes the copy and
move special members based on whether every alternative is copy/move
constructible. The variant's special members are now defaulted, so they
are deleted unless all alternatives support the operation.

Fixes: #1512

Further, same-type-assignment optimization: Previously, assignment
was destroy-and-reconstruct. Now, copy/move-assign are enabled if
the types allow for it.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-19 12:00:41 +01:00
..
etl Fix variant copy operations enabled with non-copyable alternatives (#1514) 2026-07-19 12:00:41 +01:00