在线文档教程
C++
应用 | Utilities

std::swap(std::variant)

STD::交换%28 std::变体%29

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

重载std::swap算法std::variant.有效地打电话lhs.swap(rhs)...

此重载只参与在下列情况下的重载解决方案:is_move_constructible_v<T_i>和is_swappable_v<T_i>对所有人都是正确的T_i在Types...

参数

lhs, rhs-variant objects whose values to swap

返回值

%280%29

例外

noexcept规格:

noexcept(noexcept(lhs.swap(rhs)))

另见

swapswaps with another variant (public member function)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/实用程序/变量/swap 2