Skip to content

Commit c84cced

Browse files
AlisdairMtkoeppe
authored andcommitted
P3570R2 optional variants in sender/receiver
1 parent 4448006 commit c84cced

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

source/exec.tex

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@
464464
struct @\libglobal{get_forward_progress_guarantee_t}@ { @\unspec@ };
465465
template<class CPO>
466466
struct @\libglobal{get_completion_scheduler_t}@ { @\unspec@ };
467+
struct get_await_completion_adaptor_t { @\unspec@ };
467468

468469
inline constexpr get_domain_t @\libglobal{get_domain}@{};
469470
inline constexpr get_scheduler_t @\libglobal{get_scheduler}@{};
@@ -472,6 +473,7 @@
472473
inline constexpr get_forward_progress_guarantee_t @\libglobal{get_forward_progress_guarantee}@{};
473474
template<class CPO>
474475
constexpr get_completion_scheduler_t<CPO> @\libglobal{get_completion_scheduler}@{};
476+
inline constexpr get_await_completion_adaptor_t get_await_completion_adaptor{};
475477

476478
struct @\libglobal{get_env_t}@ { @\unspec@ };
477479
inline constexpr get_env_t @\libglobal{get_env}@{};
@@ -1007,6 +1009,22 @@
10071009
\tcode{forwarding_query(get_completion_scheduler<\exposid{completion-tag}>)}
10081010
is a core constant expression and has value \tcode{true}.
10091011

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+
\tcode{get_await_completion_adaptor(env)} is expression-equivalent to
1022+
\tcode{\exposid{MANDATE-NOTHROW}(\exposid{AS-CONST}(env).query(get_await_completion_adaptor))}.
1023+
1024+
\pnum
1025+
\tcode{forwarding_query(execution::get_await_completion_adaptor)}
1026+
is a core constant expression and has value \tcode{true}.
1027+
10101028
\rSec1[exec.sched]{Schedulers}
10111029

10121030
\pnum
@@ -5489,6 +5507,13 @@
54895507
{ p.unhandled_stopped() } -> @\libconcept{convertible_to}@<coroutine_handle<>>;
54905508
};
54915509

5510+
template<class Sndr>
5511+
concept @\defexposconcept{has-queryable-await-completion-adaptor}@ = // \expos
5512+
@\libconcept{sender}@<Sndr> &&
5513+
requires(Sndr&& sender) {
5514+
get_await_completion_adaptor(get_env(sender));
5515+
};
5516+
54925517
template<class Sndr, class Promise>
54935518
class @\exposidnc{sender-awaitable}@; // \expos
54945519
}
@@ -5630,6 +5655,13 @@
56305655
in a coroutine with promise type \tcode{U} is expression-equivalent to
56315656
the same expression in a coroutine with promise type \tcode{Promise}.
56325657
\item
5658+
Otherwise, \tcode{\exposid{sender-awaitable}\{\exposid{adapted-expr}, p\}}
5659+
if \tcode{\exposid{has-queryable-await-completion-adaptor}<Expr>}
5660+
and \tcode{\exposid{awaitable-sender}<decltype((\exposid{adapted-expr})), Promise>}
5661+
are both satisfied, where \exposid{adapted-expr} is
5662+
\tcode{get_await_completion_adaptor(get_env(expr))(expr)},
5663+
except that \tcode{expr} is evaluated only once.
5664+
\item
56335665
Otherwise, \tcode{\exposid{sender-awaitable}\{expr, p\}}
56345666
if \tcode{\exposconcept{awaitable-sender}<Expr, Promise>} is \tcode{true}.
56355667
\item

source/support.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@
816816
#define @\defnlibxname{cpp_lib_saturation_arithmetic}@ 202311L // also in \libheader{numeric}
817817
#define @\defnlibxname{cpp_lib_scoped_lock}@ 201703L // also in \libheader{mutex}
818818
#define @\defnlibxname{cpp_lib_semaphore}@ 201907L // also in \libheader{semaphore}
819-
#define @\defnlibxname{cpp_lib_senders}@ 202406L // also in \libheader{execution}
819+
#define @\defnlibxname{cpp_lib_senders}@ 202506L // also in \libheader{execution}
820820
#define @\defnlibxname{cpp_lib_shared_mutex}@ 201505L // also in \libheader{shared_mutex}
821821
#define @\defnlibxname{cpp_lib_shared_ptr_arrays}@ 201707L // also in \libheader{memory}
822822
#define @\defnlibxname{cpp_lib_shared_ptr_weak_type}@ 201606L // also in \libheader{memory}

0 commit comments

Comments
 (0)