◐ Shell
clean mode source ↗

std::swap(std::shared_ptr) - cppreference.com

提供: cppreference.com

<tbody> </tbody>

template< class T > void swap( shared_ptr<T>& lhs, shared_ptr<T>& rhs ) noexcept;

(C++11以上)

std::shared_ptr に対して std::swap アルゴリズムを特殊化します。 lhsrhs のポインタを入れ替えます。 lhs.swap(rhs) を呼びます。

引数

lhs, rhs - 内容を入れ替えるスマートポインタ

戻り値

(なし)

計算量

一定。

関連項目