This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
[exec.affine.on]
# 33 Execution control library [[exec]](./#exec)
## 33.13 Coroutine utilities [[exec.coro.util]](exec.coro.util#exec.affine.on)
### 33.13.3 execution::affine_on [exec.affine.on]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6877)
affine_on adapts a sender into one that completes on
the specified scheduler[.](#1.sentence-1)
If the algorithm determines that the adapted sender already completes
on the correct scheduler it can avoid any scheduling operation[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6883)
The name affine_on denotes a pipeable sender adaptor
object[.](#2.sentence-1)
For subexpressions sch and sndr, if decltype((sch)) does not satisfy [scheduler](exec.sched#concept:scheduler "33.6Schedulers[exec.sched]"), or decltype((sndr)) does not satisfy [sender](exec.snd.concepts#concept:sender "33.9.3Sender concepts[exec.snd.concepts]"), affine_on(sndr, sch) is ill-formed[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6891)
Otherwise, the expression affine_on(sndr, sch) is
expression-equivalent to:transform_sender(*get-domain-early*(sndr), *make-sender*(affine_on, sch, sndr)) except that sndr is evaluated only once[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6899)
The exposition-only class template *impls-for* ([[exec.snd.expos]](exec.snd.expos "33.9.2Exposition-only entities"))
is specialized for affine_on_t as follows:
namespace std::execution {template<>struct *impls-for*<affine_on_t> : *default-impls* {static constexpr auto *get-attrs* =[](const auto& data, const auto& child) noexcept -> decltype(auto) {return *JOIN-ENV*(*SCHED-ATTRS*(data), *FWD-ENV*(get_env(child))); }; };}
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L6915)
Let *out_sndr* be a subexpression denoting a sender
returned from affine_on(sndr, sch) or one equal to such,
and let *OutSndr* be the type decltype((*out_sndr*))[.](#5.sentence-1)
Let *out_rcvr* be a subexpression denoting a receiver that
has an environment of type Env such that [sender_in](exec.snd.concepts#concept:sender_in "33.9.3Sender concepts[exec.snd.concepts]")<*OutSndr*, Env> is true[.](#5.sentence-2)
Let *op* be an lvalue referring to the operation state that
results from connecting *out_sndr* to *out_rcvr*[.](#5.sentence-3)
Calling start(*op*) will start sndr on the current
execution agent and execute completion operations on *out_rcvr* on an execution agent of the execution resource associated withsch[.](#5.sentence-4)
If the current execution resource is the same as the execution
resource associated with sch, the completion operation on*out_rcvr* may be called before start(*op*) completes[.](#5.sentence-5)
If scheduling onto sch fails, an error completion on*out_rcvr* shall be executed on an unspecified execution
agent[.](#5.sentence-6)