Namespaces
Variants

std:: swap (std::polymorphic)

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
定义于头文件 <memory>
constexpr void swap ( polymorphic & lhs, polymorphic & rhs )
noexcept ( noexcept ( lhs. swap ( rhs ) ) ) ;
(C++26 起)

std::polymorphic 重载 std::swap 算法。将 lhs 的状态与 rhs 的状态进行交换。实际调用 lhs. swap ( rhs )

参数

lhs, rhs - 要交换状态的 polymorphic 对象

示例

参见

交换内容
(公开成员函数)