◐ Shell
clean mode source ↗

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

提供: cppreference.com

<tbody> </tbody>

ヘッダ <array> で定義

template< class T, std::size_t N > void swap( array<T,N>& lhs, array<T,N>& rhs );

(C++11以上)
(C++17未満)

template< class T, std::size_t N > void swap( array<T,N>& lhs, array<T,N>& rhs ) noexcept(/* see below */);

(C++17以上)
(C++20未満)

template< class T, std::size_t N > constexpr void swap( array<T,N>& lhs, array<T,N>& rhs ) noexcept(/* see below */);

(C++20以上)

std::array に対する std::swap アルゴリズムの特殊化。 lhsrhs の内容を入れ替えます。 lhs.swap(rhs) を呼びます。

このオーバーロードは、N == 0 または std::is_swappable<T>::valuetrue である場合にのみ、オーバーロード解決に参加します。

(C++17以上)

引数

戻り値

(なし)

計算量

コンテナのサイズに比例。

例外

noexcept

指定:  

noexcept(noexcept(lhs.swap(rhs)))

(C++17以上)

関連項目