Difference between revisions of "cpp/utility/variant/swap2"
From cppreference.com
m (paste typo) |
(LWG 2749) |
||
Line 10: | Line 10: | ||
Overloads the {{lc|std::swap}} algorithm for {{lc|std::variant}}. Effectively calls {{c|lhs.swap(rhs)}}. | Overloads the {{lc|std::swap}} algorithm for {{lc|std::variant}}. Effectively calls {{c|lhs.swap(rhs)}}. | ||
+ | |||
+ | {{cpp/enable if|{{c|is_move_constructible_v<T_i>}} and {{c|is_swappable_v<T_i>}} are both true for all {{tt|T_i}} in {{tt|Types...}}}} | ||
===Parameters=== | ===Parameters=== | ||
Line 20: | Line 22: | ||
===Exceptions=== | ===Exceptions=== | ||
− | {{noexcept|lhs.swap(rhs)}} | + | {{noexcept|noexcept(lhs.swap(rhs))}} |
===Example=== | ===Example=== |
Revision as of 00:50, 20 November 2016
Defined in header <variant>
|
||
template <class... Types> void swap(variant<Types...>& lhs, variant<Types...>& rhs) |
(since C++17) | |
Overloads the std::swap algorithm for std::variant. Effectively calls lhs.swap(rhs).
This overload participates in overload resolution only if is_move_constructible_v<T_i> and is_swappable_v<T_i> are both true for all T_i
in Types...
Contents |
Parameters
lhs, rhs | - | variant objects whose values to swap
|
Return value
(none)
Exceptions
noexcept specification:
noexcept(noexcept(lhs.swap(rhs)))
Example
This section is incomplete Reason: no example |
See also
swaps with another variant (public member function) |