Files
cppdraft_translate/cppdraft/exec/scope/concepts.md
2025-10-25 03:02:53 +03:00

56 lines
2.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[exec.scope.concepts]
# 33 Execution control library [[exec]](./#exec)
## 33.14 Execution scope utilities [[exec.scope]](exec.scope#concepts)
### 33.14.1 Execution scope concepts [exec.scope.concepts]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L7711)
The [scope_token](#concept:scope_token "33.14.1Execution scope concepts[exec.scope.concepts]") concept defines the requirements on
a type Token that can be used to create associations
between senders and an async scope[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L7716)
Let *test-sender* and *test-env* be unspecified types such that[sender_in](exec.snd.concepts#concept:sender_in "33.9.3Sender concepts[exec.snd.concepts]")<*test-sender*, *test-env*> is modeled[.](#2.sentence-1)
namespace std::execution {template<class Token>concept [scope_token](#concept:scope_token "33.14.1Execution scope concepts[exec.scope.concepts]") =[copyable](concepts.object#concept:copyable "18.6Object concepts[concepts.object]")<Token> &&requires(const Token token) {{ token.try_associate() } -> [same_as](concept.same#concept:same_as "18.4.2Concept same_­as[concept.same]")<bool>; { token.disassociate() } noexcept -> [same_as](concept.same#concept:same_as "18.4.2Concept same_­as[concept.same]")<void>; { token.wrap(declval<*test-sender*>()) } -> [sender_in](exec.snd.concepts#concept:sender_in "33.9.3Sender concepts[exec.snd.concepts]")<*test-env*>; };}
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L7735)
A type Token models [scope_token](#concept:scope_token "33.14.1Execution scope concepts[exec.scope.concepts]") only if:
- [(3.1)](#3.1)
no exceptions are thrown from
copy construction,
move construction,
copy assignment, or
move assignment
of objects of type Token; and
- [(3.2)](#3.2)
given an lvalue token of type (possibly const) Token,
for all expressions sndr such thatdecltype((
sndr)) models [sender](exec.snd.concepts#concept:sender "33.9.3Sender concepts[exec.snd.concepts]"):
* [(3.2.1)](#3.2.1)
token.wrap(sndr) is a valid expression,
* [(3.2.2)](#3.2.2)
decltype(token.wrap(sndr)) models [sender](exec.snd.concepts#concept:sender "33.9.3Sender concepts[exec.snd.concepts]"), and
* [(3.2.3)](#3.2.3)
completion_signatures_of_t<decltype(token.wrap(sndr)), E> contains the same completion signatures as completion_signatures_of_t<decltype((sndr)), E> for all types E such that [sender_in](exec.snd.concepts#concept:sender_in "33.9.3Sender concepts[exec.snd.concepts]")<decltype((sndr)), E> is modeled.