-
Notifications
You must be signed in to change notification settings - Fork 809
[2026-03 LWG Motion 11] P3986R1 A Wording Strategy for Inlinable Receivers #8915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jensmaurer
wants to merge
1
commit into
main
Choose a base branch
from
motions-2026-03-lwg-11
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+95
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -502,6 +502,9 @@ | |||||
| template<class Rcvr, class Completions> | ||||||
| concept @\libconcept{receiver_of}@ = @\seebelow@; | ||||||
|
|
||||||
| template<class Rcvr, class ChildOp> | ||||||
| concept @\libconcept{inlinable_receiver}@ = @\seebelow@; | ||||||
|
|
||||||
| struct @\libglobal{set_value_t}@ { @\unspec@ }; | ||||||
| struct @\libglobal{set_error_t}@ { @\unspec@ }; | ||||||
| struct @\libglobal{set_stopped_t}@ { @\unspec@ }; | ||||||
|
|
@@ -1230,6 +1233,98 @@ | |||||
| must be destroyed before the invocation of the completion operation. | ||||||
| \end{note} | ||||||
|
|
||||||
| \pnum | ||||||
| \begin{codeblock} | ||||||
| namespace std::execution { | ||||||
| template<class Rcvr, class ChildOp> | ||||||
| concept @\deflibconcept{inlinable_receiver}@ = @\libconcept{receiver}@<Rcvr> && | ||||||
| requires (ChildOp* child) { | ||||||
| { remove_cvref_t<Rcvr>::make_receiver_for(child) } noexcept | ||||||
| -> @\libconcept{same_as}@<remove_cvref_t<Rcvr>>; | ||||||
| }; | ||||||
| } | ||||||
| \end{codeblock} | ||||||
|
|
||||||
| The \libconcept{inlinable_receiver} concept | ||||||
| defines the requirements for a receiver | ||||||
| that can be reconstructed on demand | ||||||
| from a pointer to the operation state object | ||||||
| created when the receiver was connected to a sender. | ||||||
| Given a receiver object \tcode{rcvr} of type \tcode{Rcvr} | ||||||
| which was connected to a sender producing | ||||||
| an operation state object \tcode{op} of type \tcode{Op}, | ||||||
| \tcode{Rcvr} models \tcode{\libconcept{inlinable_receiver}<Op>} | ||||||
| only if the expression \tcode{Rcvr::make_receiver_for(addressof(op))} | ||||||
| evaluates to a receiver | ||||||
| that is equal to \tcode{rcvr}\iref{concepts.equality}. | ||||||
| \begin{note} | ||||||
| Such a receiver does not need to be stored as a data member of \tcode{op} | ||||||
| as it can be recreated on demand. | ||||||
| \end{note} | ||||||
| \tcode{ChildOp} may be an incomplete type. | ||||||
|
|
||||||
| \pnum | ||||||
| Given objects $O_0, \dotsc, O_n$, | ||||||
| $O_n$ is \defnadj{transitively}{constructed} from $O_0$ if | ||||||
| \begin{itemize} | ||||||
| \item | ||||||
| \tcode{remove_cvref_t<decltype($O_n$)>} | ||||||
| denotes the same type as | ||||||
| \tcode{remove_cvref_t<decltype($O_0$)>} and | ||||||
| \item | ||||||
| either | ||||||
| \begin{itemize} | ||||||
| \item | ||||||
| $O_1$ was initialized by decay-copying a reference to $O_0$ or | ||||||
| \item | ||||||
| $n > 1$ and $O_{n-1}$ is transitively constructed from $O_0$ and | ||||||
| $O_n$ was initialized from | ||||||
| a non-const, non-volatile rvalue reference to $O_{n-1}$. | ||||||
| \end{itemize} | ||||||
| \end{itemize} | ||||||
|
|
||||||
| \pnum | ||||||
| Let $E$ be some well-formed expression \tcode{connect(sndr, rcvr)}. | ||||||
| $E$ \defn{inlines the receiver} \tcode{rcvr} | ||||||
| if the lifetimes of all objects transitively constructed from | ||||||
| \tcode{rcvr} during the evaluation of $E$ | ||||||
| end within the evaluation of $E$. | ||||||
|
|
||||||
| \begin{note} | ||||||
| This means such an expression does not store the receiver in the operation state. | ||||||
| \end{note} | ||||||
|
|
||||||
| \pnum | ||||||
| Let $E$ be some well-formed expression \tcode{connect(sndr, rcvr)} where | ||||||
| \begin{itemize} | ||||||
| \item | ||||||
| \tcode{sndr} denotes a sender type defined by this document and | ||||||
| \item | ||||||
| $E$ inlines the receiver \tcode{rcvr}. | ||||||
| \end{itemize} | ||||||
| Then, let \tcode{op} be the result of the evaluation of $E$, and | ||||||
| wherever the specification of the operation associated with \tcode{op} | ||||||
| contains a glvalue | ||||||
| which would denote an object transitively constructed from \tcode{rcvr}, | ||||||
| that glvalue instead denotes the result of applying | ||||||
| the temporary materialization conversion to the expression | ||||||
| \tcode{remove_cvref_t<decltype(rcvr)>::make_receiver_for(addressof(op))}. | ||||||
|
|
||||||
| \pnum | ||||||
| Let \tcode{StdRcvr} be a receiver type defined by this document. | ||||||
| Given some operation state type \tcode{Op}, | ||||||
| it is unspecified whether \tcode{StdRcvr} models \tcode{inlinable_receiver<Op>}. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| \pnum | ||||||
| Let \tcode{StdOp} be some operation state type defined by this document and | ||||||
| let \tcode{Sndr} and \tcode{Rcvr} be types such that | ||||||
| \tcode{is_same_v<connect_result_t<Sndr, Rcvr>, StdOp>} is \tcode{true}. | ||||||
| If \tcode{Rcvr} models \tcode{inlinable_receiver<StdOp>} | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| then it is implementation-defined whether, | ||||||
| given an object \tcode{rcvr} of type \tcode{Rcvr}, | ||||||
| the \tcode{connect} operation which produces an object of type \tcode{StdOp} | ||||||
| inlines the receiver \tcode{rcvr}. | ||||||
|
|
||||||
| \rSec2[exec.set.value]{\tcode{execution::set_value}} | ||||||
|
|
||||||
| \pnum | ||||||
|
|
||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there really be an empty line here if the note is attached to the previous paragraph?