Init
This commit is contained in:
45
cppdraft/exec/stopped/err.md
Normal file
45
cppdraft/exec/stopped/err.md
Normal file
@@ -0,0 +1,45 @@
|
||||
[exec.stopped.err]
|
||||
|
||||
# 33 Execution control library [[exec]](./#exec)
|
||||
|
||||
## 33.9 Senders [[exec.snd]](exec.snd#exec.stopped.err)
|
||||
|
||||
### 33.9.12 Sender adaptors [[exec.adapt]](exec.adapt#exec.stopped.err)
|
||||
|
||||
#### 33.9.12.15 execution::stopped_as_error [exec.stopped.err]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4856)
|
||||
|
||||
stopped_as_error maps an input sender's stopped completion operation
|
||||
into an error completion operation as a custom error type[.](#1.sentence-1)
|
||||
|
||||
The result is a sender that never completes with stopped,
|
||||
reporting cancellation by completing with an error[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4862)
|
||||
|
||||
The name stopped_as_error denotes a pipeable sender adaptor object[.](#2.sentence-1)
|
||||
|
||||
For some subexpressions sndr and err,
|
||||
let Sndr be decltype((sndr)) and
|
||||
let Err be decltype((err))[.](#2.sentence-2)
|
||||
|
||||
If the type Sndr does not satisfy [sender](exec.snd.concepts#concept:sender "33.9.3 Sender concepts [exec.snd.concepts]") or
|
||||
if the type Err does not satisfy [*movable-value*](exec.general#concept:movable-value "33.1 General [exec.general]"),stopped_as_error(sndr, err) is ill-formed[.](#2.sentence-3)
|
||||
|
||||
Otherwise, the expression stopped_as_error(sndr, err) is expression-equivalent to:transform_sender(*get-domain-early*(sndr), *make-sender*(stopped_as_error, err, sndr)) except that sndr is only evaluated once[.](#2.sentence-4)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4877)
|
||||
|
||||
Let sndr and env be subexpressions
|
||||
such that Sndr is decltype((sndr)) andEnv is decltype((env))[.](#3.sentence-1)
|
||||
|
||||
If [*sender-for*](exec.snd.concepts#concept:sender-for "33.9.3 Sender concepts [exec.snd.concepts]")<Sndr, stopped_as_error_t> is false,
|
||||
then the expression stopped_as_error.transform_sender(sndr, env) is ill-formed;
|
||||
otherwise, it is equivalent to:auto&& [_, err, child] = sndr;using E = decltype(auto(err));return let_stopped( std::forward_like<Sndr>(child), [err = std::forward_like<Sndr>(err)]() mutable noexcept(is_nothrow_move_constructible_v<E>) {return just_error(std::move(err)); });
|
||||
57
cppdraft/exec/stopped/opt.md
Normal file
57
cppdraft/exec/stopped/opt.md
Normal file
@@ -0,0 +1,57 @@
|
||||
[exec.stopped.opt]
|
||||
|
||||
# 33 Execution control library [[exec]](./#exec)
|
||||
|
||||
## 33.9 Senders [[exec.snd]](exec.snd#exec.stopped.opt)
|
||||
|
||||
### 33.9.12 Sender adaptors [[exec.adapt]](exec.adapt#exec.stopped.opt)
|
||||
|
||||
#### 33.9.12.14 execution::stopped_as_optional [exec.stopped.opt]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4789)
|
||||
|
||||
stopped_as_optional maps a sender's stopped completion operation
|
||||
into a value completion operation as a disengaged optional[.](#1.sentence-1)
|
||||
|
||||
The sender's value completion operation
|
||||
is also converted into an optional[.](#1.sentence-2)
|
||||
|
||||
The result is a sender that never completes with stopped,
|
||||
reporting cancellation by completing with a disengaged optional[.](#1.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4797)
|
||||
|
||||
The name stopped_as_optional denotes a pipeable sender adaptor object[.](#2.sentence-1)
|
||||
|
||||
For a subexpression sndr, let Sndr be decltype((sndr))[.](#2.sentence-2)
|
||||
|
||||
The expression stopped_as_optional(sndr) is expression-equivalent to:transform_sender(*get-domain-early*(sndr), *make-sender*(stopped_as_optional, {}, sndr)) except that sndr is only evaluated once[.](#2.sentence-3)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4806)
|
||||
|
||||
The exposition-only class template *impls-for* ([[exec.snd.expos]](exec.snd.expos "33.9.2 Exposition-only entities"))
|
||||
is specialized for stopped_as_optional_t as follows:
|
||||
|
||||
[ð](#lib:impls-for%3cstopped_as_optional_t%3e)
|
||||
|
||||
namespace std::execution {template<>struct *impls-for*<stopped_as_optional_t> : *default-impls* {template<class Sndr, class... Env>static consteval void *check-types*() {*default-impls*::*check-types*<Sndr, Env...>(); if constexpr (!requires {requires (<void, *single-sender-value-type*<*child-type*<Sndr>, *FWD-ENV-T*(Env)...>>); })throw *unspecified-exception*(); }};} where *unspecified-exception* is
|
||||
a type derived from exception[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4829)
|
||||
|
||||
Let sndr and env be subexpressions
|
||||
such that Sndr is decltype((sndr)) andEnv is decltype((env))[.](#4.sentence-1)
|
||||
|
||||
If [*sender-for*](exec.snd.concepts#concept:sender-for "33.9.3 Sender concepts [exec.snd.concepts]")<Sndr, stopped_as_optional_t> is false then the expression stopped_as_optional.transform_sender(sndr, env) is ill-formed;
|
||||
otherwise,
|
||||
if [sender_in](exec.snd.concepts#concept:sender_in "33.9.3 Sender concepts [exec.snd.concepts]")<*child-type*<Sndr>, *FWD-ENV-T*(Env)> is false,
|
||||
the expression stopped_as_optional.transform_sender(sndr, env) is equivalent to *not-a-sender*();
|
||||
otherwise, it is equivalent to:auto&& [_, _, child] = sndr;using V = *single-sender-value-type*<*child-type*<Sndr>, *FWD-ENV-T*(Env)>;return let_stopped( then(std::forward_like<Sndr>(child), []<class... Ts>(Ts&&... ts) noexcept(is_nothrow_constructible_v<V, Ts...>) {return optional<V>(in_place, std::forward<Ts>(ts)...); }), []() noexcept { return just(optional<V>()); });
|
||||
Reference in New Issue
Block a user