std::array<T,N>::swap
提供: cppreference.com
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&>()))) 上の式において、識別子 |
(C++17未満) |
noexcept 指定:
noexcept(std::is_nothrow_swappable_v<T>) |
(C++17以上) |
noexcept 指定:
noexcept
[編集] 計算量
コンテナのサイズに比例。
[編集] 欠陥報告
以下の動作変更欠陥報告は以前に発行された C++ 標準に遡って適用されました。
DR | 適用先 | 発行時の動作 | 正しい動作 |
---|---|---|---|
LWG 2456 | C++11 | the noexcept specification is ill-formed
|
made to work |
[編集] 関連項目
(C++11) |
std::swap アルゴリズムの特殊化 (関数テンプレート) |