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

履歴 編集

function
<stop_token>

std::stop_source::swap(C++20)

void swap(stop_source&) noexcept;

概要

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

戻り値

なし

例外

投げない。

#include <cassert>
#include <stop_token>

int main()
{
  std::stop_source ss1;
  std::stop_source ss2(std::nostopstate);

  assert(ss1.stop_possible() == true);
  assert(ss2.stop_possible() == false);

  ss1.swap(ss2);

  assert(ss1.stop_possible() == false);
  assert(ss2.stop_possible() == true);
}

出力

バージョン

言語

  • C++20

処理系

参照