33 Execution control library [exec] (original) (raw)

33.13 Coroutine utilities [exec.coro.util]

33.13.6 execution​::​task [exec.task]

33.13.6.2 Class template task [task.class]

namespace std::execution { template<class T = void, class Environment = env<>> class task { template<receiver Rcvr> class state; public: using sender_concept = sender_t;using completion_signatures = see below;using allocator_type = see below;using scheduler_type = see below;using stop_source_type = see below;using stop_token_type = decltype(declval<stop_source_type>().get_token());using error_types = see below;class promise_type; task(task&&) noexcept;~task();template<receiver Rcvr> state<Rcvr> connect(Rcvr&& rcvr) &&;private: coroutine_handle<promise_type> handle; };}

task<T, E> models sender ([exec.snd]) if T is void, a reference type, or a cv-unqualified non-array object type and E is a class type.

Otherwise a program that instantiates the definition of task<T, E>is ill-formed.

The nested types of task template specializations are determined based on the Environment parameter:

A program is ill-formed if error_types is not a specialization of execution​::​completion_signaturesor if the template arguments of that specialization contain an element which is not of the formset_error_t(E) for some type E.

The type alias completion_signatures is a specialization of execution​::​completion_signatures with the template arguments (in unspecified order):

allocator_type shall meet the _Cpp17Allocator_requirements.