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

履歴 編集

class template
<execution>

std::execution::task::state(C++26)

namespace std::execution {
  template <class T, class Environment>
    template <receiver R>
  class task<T, Environment>::state { // exposition only
  public:
    using operation_state_concept = operation_state_t;

    template <class Rcvr>
    state(coroutine_handle<promise_type> h, Rcvr&& rr);
    ~state();
    void start() & noexcept;

  private:
    using own-env-t = see below;     // exposition only
    coroutine_handle<promise_type> handle;  // exposition only
    remove_cvref_t<R>              rcvr;    // exposition only
    own-env-t                      own-env; // exposition only
    Environment                    environment; // exposition only
  };
}

概要

task<T,E>::stateは、タスクコルーチン動作の説明専用クラステンプレートである。

クラス仕様

説明専用のown-env-tは、有効な型ならばEnvironment::template env_type<decltype(get_env(declval<R>()))>となる。そうでなければenv<>となる。

template <class Rcvr>
state(coroutine_handle<promise_type> h, Rcvr&& rr);

  • 効果 :
    • handlestd::move(h)で初期化する。
    • rcvrstd::forward<Rcvr>(rr)で初期化する。
    • own-envを、式が有効ならばown-env-t(get_env(rcvr))で、そうでなければown-env-t()で初期化する。いずれの式も適格でなければ、プログラムは不適格となる。
    • environmentを、式が有効ならばEnvironment(own-env)で、そうではなく式が有効ならばEnvironment(get_env(rcvr))で、そうでなければEnvironment()で初期化する。いずれの式も適格でなければ、プログラムは不適格となる。

~state();

  • 効果 : 以下と等価。

    if (handle)
      handle.destroy();
    

void start() & noexcept;

バージョン

言語

  • C++26

関連項目

参照