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

履歴 編集

function
<stop_token>

std::inplace_stop_token::swap(C++26)

void swap(inplace_stop_token&) noexcept;

概要

他のinplace_stop_tokenオブジェクトと値を入れ替える。

戻り値

なし

例外

投げない

#include <cassert>
#include <stop_token>

int main()
{
  std::inplace_stop_source ss;
  std::inplace_stop_token st1 = ss.get_token();
  std::inplace_stop_token st2;

  assert(st1.stop_possible() == true);
  assert(st2.stop_possible() == false);

  st1.swap(st2);

  assert(st1.stop_possible() == false);
  assert(st2.stop_possible() == true);
}

出力

バージョン

言語

  • C++26

処理系

参照