std::unique_ptr<T,Deleter>::swap (3) - Linux Manuals
std::unique_ptr<T,Deleter>::swap: std::unique_ptr<T,Deleter>::swap
NAME
std::unique_ptr<T,Deleter>::swap - std::unique_ptr<T,Deleter>::swap
Synopsis
void swap(unique_ptr& other) noexcept; (since C++11)
Swaps the managed objects and associated deleters of *this and another unique_ptr object other.
Parameters
other - another unique_ptr object to swap the managed object and the deleter with
Return value
(none)
Example
// Run this code
Output: