From 4022b8a66071e1b95dd0f4cb9442b4dc194a9fa8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dietmar=20K=C3=BChl?=
+In variant can be replaced with an
result and
+error to the exposition-only class
+state:
+
+
+
+namespace std::execution {
+ template<class T, class Environment>
+ template<receiver Rcvr>
+ class task<T, Environment>::state { // exposition only
+ ...
+ Environment environment; // exposition only
+ optional<T> result; // exposition only; present only if is_void_v<T> is false
+ exception_ptr error; // exposition-only
+};
+}
+
+
+Remove the exposition-only data members
+result and errors from
+the class promise_type in
+
+
+namespace std::execution {
+ template<class T, class Environment>
+ class task<T, Environment>::promise_type {
+ ...
+ stop_token_type token; // exposition only
+ optional<T> result; // exposition only; present only if is_void_v<T> is false
+ error-variant errors; // exposition only
+};
+}
+
+
+
+
+The definition of error-variant isn't needed, i.e., remove
++ ++
+-2-error-variantis avariant<monostate, remove_cvref_t<E>...>, with duplicate types removed, whereE...are template arguments of the specialization ofexecution::completion_signaturesdenoted byerror_types. +
+In state:
+
++ +auto final_suspend() noexcept+-7- Returns: An awaitable object of unspecified type (
+ +) whose member functions arrange for the completion of the asynchronous operation associated with STATE(*this)by invoking. Letstbe a reference toSTATE(*this). The asynchronous completion first destroys the coroutine frame usingst.handle.destroy()and then invokes:+
+- -7.1-
+set_error(std::move(ifRCVR(*this)st.rcvr), std::move(est.error))errors.index()is greater than zero andeis the value held byerrorsbool(st.error)istrue, otherwise- -7.2-
+set_value(std::move(ifRCVR(*this)st.rcvr))is_void<T>istrue, and otherwise- -7.3-
+set_value(std::move(.RCVR(*this)st.rcvr), *st.result)
+Change the specification of yield_value to destroy the coroutine frame before invoking the set_error completion, i.e., change
++ +-9- Returns: An awaitable object of unspecified type ([expr.await]) whose member functions arrange for the calling coroutine to be suspended and then completes the asynchronous operation associated with
+STATE(*this)by. Letstbe a reference toSTATE(*this). Then the asynchronous operation completes by first destroying the coroutine frame usingst.handle.destroy()and then invokingset_error(std::move(. +RCVR(*this)st.rcvr), Cerr(std::move(err.error)))
+Change the specification of unhandled_stopped to destroy the coroutine frame before invoking the set_stopped completion, i.e., change
+coroutine_handle<> unhandled_stopped();+-13- Effects: Completes the asynchronous operation associated with
+STATE(*this)by. Letstbe a reference toSTATE(*this). The asynchronous operation is completed by first destroying the coroutine frame usingst.handle.destroy()and then invokingset_stopped(std::move(.RCVR(*this)st.rcvr))