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

std::swap(std::unique_ptr)

STD::SWAP%28std::UNIQUE[医]PTR%29

template< class T, class Deleter > void swap( unique_ptr& lhs, unique_ptr& rhs (since C++11)

专攻std::swap算法std::unique_ptr.交换指针lhsrhs.电话lhs.swap(rhs)...

This function does not participate in overload resolution unless std::is_swappable::value is true.(since C++17)

参数

lhs, rhs-smart pointers whose contents to swap

返回值

%280%29

例外

noexcept规格:

noexcept

复杂性

常量。

另见

swapswaps the values of two objects (function template)
swapswaps the contents (public member function)

© cppreference.com

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

http://en.cppreference.com/w/cpp/Memory/UNIQUE[医]PTR/SWAP 2