std::stack<T,Container>::swap
提供: cppreference.com
void swap( stack& other )noexcept(/* see below */); | (C++11以上) | |
コンテナアダプタの内容を other
の内容と交換します。 実質的に usingstd::swap; swap(c, other.c); を呼びます。
目次 |
[編集]引数
other | - | 内容を交換するコンテナアダプタ |
[編集]戻り値
(なし)
[編集]例外
noexcept 指定: noexcept(noexcept(swap(c, other.c))) 上記の式に加え、識別子 | (C++17未満) |
noexcept 指定: noexcept(std::is_nothrow_swappable<Container>::value) | (C++17以上) |
[編集]計算量
ベースとなるコンテナと同じ (一般的には定数時間)。
[編集]欠陥報告
以下の動作変更欠陥報告は以前に発行された C++ 標準に遡って適用されました。
DR | 適用先 | 発行時の動作 | 正しい動作 |
---|---|---|---|
LWG 2456 | C++11 | the noexcept specification is ill-formed | made to work |
[編集]関連項目
std::swap アルゴリズムの特殊化 (関数テンプレート) |