template<class Rcvr>
struct run-loop-opstate;
概要
run-loop-opstateは、run_loop動作説明で利用される説明専用のクラスである。
クラス仕様
説明専用の基底クラスrun-loop-opstate-baseを下記の通り定義する。
run-loop-opstate<Rcvr>は、run-loop-opstate-baseから曖昧さなくprivate継承したクラスである。
struct run-loop-opstate-base { // exposition only
virtual void execute() = 0; // exposition only
run_loop* loop; // exposition only
run-loop-opstate-base* next; // exposition only
};
説明用のoをrun-loop-opstate<Rcvr>型の非const左辺値、REC(o)をoを返す接続(connect)呼び出しへ渡した式rcvrで初期化されたRcvr型の非const左辺値参照とする。
REC(o)が参照するオブジェクトは、oが参照するオブジェクトの生存期間(lifetime)で有効である。-
型
run-loop-opstate<Rcvr>はrun-loop-opstate-base::execute()をオーバーライドし、式o.execute()は下記と等価 :if (get_stop_token(REC(o)).stop_requested()) { set_stopped(std::move(REC(o))); } else { set_value(std::move(REC(o))); } -
式
start(o)は下記と等価 :try { o.loop->push-back(addressof(o)); } catch(...) { set_error(std::move(REC(o)), current_exception()); }
バージョン
言語
- C++26