Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 684 Bytes

File metadata and controls

54 lines (39 loc) · 684 Bytes

swap

  • thread[meta header]
  • std[meta namespace]
  • jthread[meta class]
  • function[meta id-type]
  • cpp20[meta cpp]
void swap(jthread& x) noexcept;

概要

別のjthreadと交換する。

効果

*thisxを入れ替える。

例外

送出しない。

#include <thread>

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

  t1.swap(t2);

  t2.join();

  return 0;
}
  • swap[color ff0000]
  • join[link join.md]

出力

バージョン

言語

  • C++20

処理系