最終更新日時(UTC):
が更新

履歴 編集

function
<thread>

std::thread::swap(C++11)

void swap(thread& x) noexcept;

概要

別のthreadと交換する。

効果

*thisxを入れ替える。

例外

送出しない。

#include <thread>

int main()
{
  std::thread t1([]{ /*...*/ });
  std::thread t2;

  t1.swap(t2);

  t2.join();

  return 0;
}

出力

バージョン

言語

  • C++11

処理系

参照