|
502 | 502 | template<class Rcvr, class Completions> |
503 | 503 | concept @\libconcept{receiver_of}@ = @\seebelow@; |
504 | 504 |
|
| 505 | + template<class Rcvr, class ChildOp> |
| 506 | + concept @\libconcept{inlinable_receiver}@ = @\seebelow@; |
| 507 | + |
505 | 508 | struct @\libglobal{set_value_t}@ { @\unspec@ }; |
506 | 509 | struct @\libglobal{set_error_t}@ { @\unspec@ }; |
507 | 510 | struct @\libglobal{set_stopped_t}@ { @\unspec@ }; |
|
1230 | 1233 | must be destroyed before the invocation of the completion operation. |
1231 | 1234 | \end{note} |
1232 | 1235 |
|
| 1236 | +\pnum |
| 1237 | +\begin{codeblock} |
| 1238 | +namespace std::execution { |
| 1239 | + template<class Rcvr, class ChildOp> |
| 1240 | + concept @\deflibconcept{inlinable_receiver}@ = @\libconcept{receiver}@<Rcvr> && |
| 1241 | + requires (ChildOp* child) { |
| 1242 | + { remove_cvref_t<Rcvr>::make_receiver_for(child) } noexcept |
| 1243 | + -> @\libconcept{same_as}@<remove_cvref_t<Rcvr>>; |
| 1244 | + }; |
| 1245 | +} |
| 1246 | +\end{codeblock} |
| 1247 | + |
| 1248 | +The \libconcept{inlinable_receiver} concept |
| 1249 | +defines the requirements for a receiver |
| 1250 | +that can be reconstructed on demand |
| 1251 | +from a pointer to the operation state object |
| 1252 | +created when the receiver was connected to a sender. |
| 1253 | +Given a receiver object \tcode{rcvr} of type \tcode{Rcvr} |
| 1254 | +which was connected to a sender producing |
| 1255 | +an operation state object \tcode{op} of type \tcode{Op}, |
| 1256 | +\tcode{Rcvr} models \tcode{\libconcept{inlinable_receiver}<Op>} |
| 1257 | +only if the expression \tcode{Rcvr::make_receiver_for(addressof(op))} |
| 1258 | +evaluates to a receiver |
| 1259 | +that is equal to \tcode{rcvr}\iref{concepts.equality}. |
| 1260 | +\begin{note} |
| 1261 | +Such a receiver does not need to be stored as a data member of \tcode{op} |
| 1262 | +as it can be recreated on demand. |
| 1263 | +\end{note} |
| 1264 | +\tcode{ChildOp} may be an incomplete type. |
| 1265 | + |
| 1266 | +\pnum |
| 1267 | +Given objects $O_0, \dotsc, O_n$, |
| 1268 | +$O_n$ is \defnadj{transitively}{constructed} from $O_0$ if |
| 1269 | +\begin{itemize} |
| 1270 | +\item |
| 1271 | +\tcode{remove_cvref_t<decltype($O_n$)>} |
| 1272 | +denotes the same type as |
| 1273 | +\tcode{remove_cvref_t<decltype($O_0$)>} and |
| 1274 | +\item |
| 1275 | +either |
| 1276 | +\begin{itemize} |
| 1277 | +\item |
| 1278 | +$O_1$ was initialized by decay-copying a reference to $O_0$ or |
| 1279 | +\item |
| 1280 | +$n > 1$ and $O_{n-1}$ is transitively constructed from $O_0$ and |
| 1281 | +$O_n$ was initialized from |
| 1282 | +a non-const, non-volatile rvalue reference to $O_{n-1}$. |
| 1283 | +\end{itemize} |
| 1284 | +\end{itemize} |
| 1285 | + |
| 1286 | +\pnum |
| 1287 | +Let $E$ be some well-formed expression \tcode{connect(sndr, rcvr)}. |
| 1288 | +$E$ \defn{inlines the receiver} \tcode{rcvr} |
| 1289 | +if the lifetimes of all objects transitively constructed from |
| 1290 | +\tcode{rcvr} during the evaluation of $E$ |
| 1291 | +end within the evaluation of $E$. |
| 1292 | + |
| 1293 | +\begin{note} |
| 1294 | +This means such an expression does not store the receiver in the operation state. |
| 1295 | +\end{note} |
| 1296 | + |
| 1297 | +\pnum |
| 1298 | +Let $E$ be some well-formed expression \tcode{connect(sndr, rcvr)} where |
| 1299 | +\begin{itemize} |
| 1300 | +\item |
| 1301 | +\tcode{sndr} denotes a sender type defined by this document and |
| 1302 | +\item |
| 1303 | +$E$ inlines the receiver \tcode{rcvr}. |
| 1304 | +\end{itemize} |
| 1305 | +Then, let \tcode{op} be the result of the evaluation of $E$, and |
| 1306 | +wherever the specification of the operation associated with \tcode{op} |
| 1307 | +contains a glvalue |
| 1308 | +which would denote an object transitively constructed from \tcode{rcvr}, |
| 1309 | +that glvalue instead denotes the result of applying |
| 1310 | +the temporary materialization conversion to the expression |
| 1311 | +\tcode{remove_cvref_t<decltype(rcvr)>::make_receiver_for(addressof(op))}. |
| 1312 | + |
| 1313 | +\pnum |
| 1314 | +Let \tcode{StdRcvr} be a receiver type defined by this document. |
| 1315 | +Given some operation state type \tcode{Op}, |
| 1316 | +it is unspecified whether \tcode{StdRcvr} models \tcode{inlinable_receiver<Op>}. |
| 1317 | + |
| 1318 | +\pnum |
| 1319 | +Let \tcode{StdOp} be some operation state type defined by this document and |
| 1320 | +let \tcode{Sndr} and \tcode{Rcvr} be types such that |
| 1321 | +\tcode{is_same_v<connect_result_t<Sndr, Rcvr>, StdOp>} is \tcode{true}. |
| 1322 | +If \tcode{Rcvr} models \tcode{inlinable_receiver<StdOp>} |
| 1323 | +then it is implementation-defined whether, |
| 1324 | +given an object \tcode{rcvr} of type \tcode{Rcvr}, |
| 1325 | +the \tcode{connect} operation which produces an object of type \tcode{StdOp} |
| 1326 | +inlines the receiver \tcode{rcvr}. |
| 1327 | + |
1233 | 1328 | \rSec2[exec.set.value]{\tcode{execution::set_value}} |
1234 | 1329 |
|
1235 | 1330 | \pnum |
|
0 commit comments