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

履歴 編集

function
<execution>

std::execution::run_loop::get_scheduler(C++26)

run-loop-scheduler get_scheduler();

概要

run_loop上で実行するSchedulerを返す。

戻り値

run_loopインスタンス上で作業をスケジュールするrun-loop-schedulerインスタンスを返す。

#include <cassert>
#include <concepts>
#include <execution>
namespace ex = std::execution;

int main()
{
  ex::run_loop loop;
  ex::scheduler auto sch = loop.get_scheduler();

  // スケジュールSenderを作成
  ex::sender auto sndr = ex::schedule(sch);

  // スケジュールSenderの完了シグネチャ集合を確認
  auto sigs = ex::get_completion_signatures(sndr);
  static_assert(std::same_as<decltype(sigs),
    ex::completion_signatures<ex::set_value_t(),
                              ex::set_error_t(std::exception_ptr),
                              ex::set_stopped_t()>>);

  // スケジュールSender属性の値完了スケジューラを確認
  auto compl_sch = ex::get_completion_scheduler<ex::set_value_t>(ex::get_env(sndr));
  assert(compl_sch == sch);
}

出力

バージョン

言語

  • C++26

処理系

関連項目

参照