std::swap(std::unique_ptr)
From cppreference.com
< cpp | memory | unique ptr
Defined in header <memory>
|
||
template< class T, class D > void swap( std::unique_ptr<T, D>& lhs, std::unique_ptr<T, D>& rhs ) noexcept; |
(since C++11) | |
Specializes the std::swap algorithm for std::unique_ptr. Swaps the contents of lhs
and rhs
. Calls lhs.swap(rhs).
This function does not participate in overload resolution unless std::is_swappable_v<D> is true. |
(since C++17) |
Contents |
[edit] Parameters
lhs, rhs | - | smart pointers whose contents to swap |
[edit] Return value
(none)
[edit] Complexity
Constant
[edit] See also
swaps the values of two objects (function template) | |
swaps the contents (public member function) |