名前空間
変種
操作

std::array<T,N>::swap

提供: cppreference.com
< cpp‎ | container‎ | array
 
 
 
 
void swap( array& other ) noexcept(/* see below */);
(C++11以上)
(C++20未満)
constexpr void swap( array& other ) noexcept(/* see below */);
(C++20以上)

コンテナの内容を other の内容と交換します。 イテレータや参照の other コンテナへの紐付けは発生しません。

目次

[編集] 引数

other - 内容を交換するコンテナ

[編集] 戻り値

(なし)

[編集] 例外

noexcept 指定:  
noexcept(noexcept(swap(std::declval<T&>(), std::declval<T&>())))

上の式において、識別子 swap は C++17 の std::is_nothrow_swappable 特性によって使用されるものと同じ方法によって探索されます。

(C++17未満)
noexcept 指定:  
(C++17以上)
サイズ0の配列に対しては、
noexcept 指定:  
noexcept
  

[編集] 計算量

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

[編集] 欠陥報告

以下の動作変更欠陥報告は以前に発行された C++ 標準に遡って適用されました。

DR 適用先 発行時の動作 正しい動作
LWG 2456 C++11 the noexcept specification is ill-formed made to work

[編集] 関連項目

std::swap アルゴリズムの特殊化
(関数テンプレート) [edit]