名前空間
変種
操作

std::priority_queue<T,Container,Compare>::swap

提供: cppreference.com
void swap( priority_queue& other ) noexcept(/* see below */);
(C++11以上)

コンテナアダプタの内容を other の内容と交換します。 実質的に using std::swap; swap(c, other.c); swap(comp, other.comp); を呼びます。

目次

[編集] 引数

other - 内容を交換するコンテナアダプタ

[編集] 戻り値

(なし)

[編集] 例外

noexcept 指定:  
noexcept(noexcept(swap(c, other.c)) && noexcept(swap(comp, other.comp)))

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

(C++17未満)
noexcept 指定:  
noexcept(std::is_nothrow_swappable<Container>::value && std::is_nothrow_swappable<Compare>::value)
(C++17以上)

[編集] 計算量

ベースとなるコンテナと同じ (一般的には定数時間)。

[編集] 欠陥報告

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

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

[編集] 関連項目

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