namespace std { void swap(thread& x, thread& y) noexcept; }
概要
2つのthread
オブジェクトを入れ替える
効果
x.swap(y);
戻り値
なし
例外
投げない
例
#include <thread> int main() { std::thread t1([]{ /*...*/ }); std::thread t2; std::swap(t1, t2); t2.join(); return 0; }
出力
バージョン
言語
- C++11
処理系
- Clang: ??
- GCC:
- GCC, C++11 mode: 4.7.0
- ICC: ??
- Visual C++: 2012, 2013, 2015