libstdc++: Refactor emplace-like functions in std::variant
authorJonathan Wakely <jwakely@redhat.com>
Tue, 2 Nov 2021 21:07:37 +0000 (21:07 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 4 Nov 2021 09:36:10 +0000 (09:36 +0000)
commita45d577b2b05e231e7a9abd43165f1e3120af013
treeeec42520221ef34b366211f04a89e0c9b97ad903
parent30ab6d9e435dd3158d971cf9353eec8009955cb3
libstdc++: Refactor emplace-like functions in std::variant

libstdc++-v3/ChangeLog:

* include/std/variant (__detail::__variant::__emplace): New
function template.
(_Copy_assign_base::operator=): Reorder conditions to match
bulleted list of effects in the standard. Use __emplace instead
of _M_reset followed by _Construct.
(_Move_assign_base::operator=): Likewise.
(__construct_by_index): Remove.
(variant::emplace): Use __emplace instead of _M_reset followed
by __construct_by_index.
(variant::swap): Hoist valueless cases out of visitor. Use
__emplace to replace _M_reset followed by _Construct.
libstdc++-v3/include/std/variant