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

履歴 編集

class template
<execution>

std::execution::run_loop::run-loop-opstate(C++26)

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() noexcept = 0;  // exposition only
  run_loop* loop;                       // exposition only
  run-loop-opstate-base* next;          // exposition only
};

説明用のorun-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)は下記と等価 :

    o.loop->push-back(addressof(o));
    

バージョン

言語

  • C++26

関連項目

参照