std::swap(std::optional)
STD::交换%28 std::可选的%29
Defined in header | | |
---|---|---|
template< class T > void swap( optional<T>& lhs, optional<T>& rhs ) noexcept(/* see below */ | | (since C++17) |
重载std::swap
算法std::optional
.交换lhs
与...rhs
.有效地打电话lhs.swap(rhs)
...
此函数模板不参与重载解析,除非std::is_move_constructible_v<T>和std::is_swappable_v<T>都是true...
参数
lhs, rhs | - | optional objects whose states to swap |
---|
返回值
%280%29
例外
noexcept
规格:
noexcept(noexcept(lhs.swap(rhs)))
例
另见
swap | exchanges the contents (public member function) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。