|
464 | 464 | struct @\libglobal{get_forward_progress_guarantee_t}@ { @\unspec@ };
|
465 | 465 | template<class CPO>
|
466 | 466 | struct @\libglobal{get_completion_scheduler_t}@ { @\unspec@ };
|
| 467 | + struct get_await_completion_adaptor_t { @\unspec@ }; |
467 | 468 |
|
468 | 469 | inline constexpr get_domain_t @\libglobal{get_domain}@{};
|
469 | 470 | inline constexpr get_scheduler_t @\libglobal{get_scheduler}@{};
|
|
472 | 473 | inline constexpr get_forward_progress_guarantee_t @\libglobal{get_forward_progress_guarantee}@{};
|
473 | 474 | template<class CPO>
|
474 | 475 | constexpr get_completion_scheduler_t<CPO> @\libglobal{get_completion_scheduler}@{};
|
| 476 | + inline constexpr get_await_completion_adaptor_t get_await_completion_adaptor{}; |
475 | 477 |
|
476 | 478 | struct @\libglobal{get_env_t}@ { @\unspec@ };
|
477 | 479 | inline constexpr get_env_t @\libglobal{get_env}@{};
|
|
1007 | 1009 | \tcode{forwarding_query(get_completion_scheduler<\exposid{completion-tag}>)}
|
1008 | 1010 | is a core constant expression and has value \tcode{true}.
|
1009 | 1011 |
|
| 1012 | +\rSec2[exec.get.await.adapt]{\tcode{execution::get_await_completion_adaptor}} |
| 1013 | + |
| 1014 | +\pnum |
| 1015 | +\tcode{get_await_completion_adaptor} asks a queryable object for |
| 1016 | +its associated awaitable completion adaptor. |
| 1017 | + |
| 1018 | +\pnum |
| 1019 | +The name \tcode{get_await_completion_adaptor} denotes a query object. |
| 1020 | +For a subexpression \tcode{env}, |
| 1021 | +\begin{codeblock} |
| 1022 | +get_await_completion_adaptor(env) |
| 1023 | +\end{codeblock} |
| 1024 | +is expression-equivalent to |
| 1025 | +\begin{codeblock} |
| 1026 | +@\exposidnc{MANDATE-NOTHROW}@(@\exposid{AS-CONST}@(env).query(get_await_completion_adaptor)) |
| 1027 | +\end{codeblock} |
| 1028 | + |
| 1029 | +\pnum |
| 1030 | +\tcode{forwarding_query(execution::get_await_completion_adaptor)} |
| 1031 | +is a core constant expression and has value \tcode{true}. |
| 1032 | + |
1010 | 1033 | \rSec1[exec.sched]{Schedulers}
|
1011 | 1034 |
|
1012 | 1035 | \pnum
|
|
5489 | 5512 | { p.unhandled_stopped() } -> @\libconcept{convertible_to}@<coroutine_handle<>>;
|
5490 | 5513 | };
|
5491 | 5514 |
|
| 5515 | + template<class Sndr> |
| 5516 | + concept @\defexposconcept{has-queryable-await-completion-adaptor}@ = // \expos |
| 5517 | + @\libconcept{sender}@<Sndr> && |
| 5518 | + requires(Sndr&& sender) { |
| 5519 | + get_await_completion_adaptor(get_env(sender)); |
| 5520 | + }; |
| 5521 | + |
5492 | 5522 | template<class Sndr, class Promise>
|
5493 | 5523 | class @\exposidnc{sender-awaitable}@; // \expos
|
5494 | 5524 | }
|
|
5630 | 5660 | in a coroutine with promise type \tcode{U} is expression-equivalent to
|
5631 | 5661 | the same expression in a coroutine with promise type \tcode{Promise}.
|
5632 | 5662 | \item
|
| 5663 | +Otherwise, \tcode{\exposid{sender-awaitable}\{\exposid{adapted-expr}, p\}} |
| 5664 | +if |
| 5665 | +\begin{codeblock} |
| 5666 | +@\exposid{has-queryable-await-completion-adaptor}@<Expr> |
| 5667 | +\end{codeblock} |
| 5668 | +and |
| 5669 | +\begin{codeblock} |
| 5670 | +@\exposid{awaitable-sender}@<decltype((@\exposid{adapted-expr}@)), Promise>} |
| 5671 | +\end{codeblock} |
| 5672 | +are both satisfied, where \exposid{adapted-expr} is |
| 5673 | +\tcode{get_await_completion_adaptor(get_env(expr))(expr)}, |
| 5674 | +except that \tcode{expr} is evaluated only once. |
| 5675 | +\item |
5633 | 5676 | Otherwise, \tcode{\exposid{sender-awaitable}\{expr, p\}}
|
5634 | 5677 | if \tcode{\exposconcept{awaitable-sender}<Expr, Promise>} is \tcode{true}.
|
5635 | 5678 | \item
|
|
0 commit comments