|
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}@{};
|
|
1005 | 1007 | \tcode{forwarding_query(get_completion_scheduler<\exposid{completion-tag}>)}
|
1006 | 1008 | is a core constant expression and has value \tcode{true}.
|
1007 | 1009 |
|
| 1010 | +\rSec2[exec.get.await.adapt]{\tcode{execution::get_await_completion_adaptor}} |
| 1011 | + |
| 1012 | +\pnum |
| 1013 | +\tcode{get_await_completion_adaptor} asks a queryable object for |
| 1014 | +its associated awaitable completion adaptor. |
| 1015 | + |
| 1016 | +\pnum |
| 1017 | +The name \tcode{get_await_completion_adaptor} denotes a query object. |
| 1018 | +For a subexpression \tcode{env}, |
| 1019 | +\tcode{get_await_completion_adaptor(env)} is expression-equivalent to |
| 1020 | +\tcode{\exposid{MANDATE-NOTHROW}(\exposid{AS-CONST}(env).query(get_await_completion_adaptor))}. |
| 1021 | + |
| 1022 | +\pnum |
| 1023 | +\tcode{forwarding_query(execution::get_await_completion_adaptor)} |
| 1024 | +is a core constant expression and has value \tcode{true}. |
| 1025 | + |
1008 | 1026 | \rSec1[exec.sched]{Schedulers}
|
1009 | 1027 |
|
1010 | 1028 | \pnum
|
|
5442 | 5460 | { p.unhandled_stopped() } -> @\libconcept{convertible_to}@<coroutine_handle<>>;
|
5443 | 5461 | };
|
5444 | 5462 |
|
| 5463 | + template<class Sndr> |
| 5464 | + concept @\defexposconcept{has-queryable-await-completion-adaptor}@ // \expos |
| 5465 | + = @\libconcept{sender}@<Sndr> |
| 5466 | + && requires(Sndr&& sender) { |
| 5467 | + get_await_completion_adaptor(get_env(sender)); |
| 5468 | + }; |
| 5469 | + |
5445 | 5470 | template<class Sndr, class Promise>
|
5446 | 5471 | class @\exposidnc{sender-awaitable}@; // \expos
|
5447 | 5472 | }
|
|
5583 | 5608 | in a coroutine with promise type \tcode{U} is expression-equivalent to
|
5584 | 5609 | the same expression in a coroutine with promise type \tcode{Promise}.
|
5585 | 5610 | \item
|
| 5611 | +Otherwise, \tcode{\exposid{sender-awaitable}\{\exposid{adapted-expr}, p\}} |
| 5612 | +if \tcode{\exposid{has-queryable-await-completion-adaptor}<Expr>} |
| 5613 | +and \tcode{\exposid{awaitable-sender}<decltype((\exposid{adapted-expr})), Promise>} |
| 5614 | +are both satisfied, where \exposid{adapted-expr} is |
| 5615 | +\tcode{get_await_completion_adaptor(get_env(expr))(expr)}, |
| 5616 | +except that \tcode{expr} is evaluated only once. |
| 5617 | +\item |
5586 | 5618 | Otherwise, \tcode{\exposid{sender-awaitable}\{expr, p\}}
|
5587 | 5619 | if \tcode{\exposconcept{awaitable-sender}<Expr, Promise>} is \tcode{true}.
|
5588 | 5620 | \item
|
|
0 commit comments