std::swap(std::variant) (3) - Linux Manuals

std::swap(std::variant): std::swap(std::variant)

NAME

std::swap(std::variant) - std::swap(std::variant)

Synopsis


Defined in header <variant>
template <class... Types> (since C++17)
void swap(variant<Types...>& lhs, variant<Types...>& rhs) noexcept(/* see below */);


Overloads the std::swap algorithm for std::variant. Effectively calls lhs.swap(rhs).
This overload only participates in overload resolution if is_move_constructible_v<T_i> and is_swappable_v<T_i> are both true for all T_i in Types...

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
swap (public member function)