Skip to content

Commit 83f7446

Browse files
committed
P3570R2 optional variants in sender/receiver
Fixes #7955 Fixes cplusplus/papers#2249
1 parent 2e12f5e commit 83f7446

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}@{};
@@ -1005,6 +1007,22 @@
10051007
\tcode{forwarding_query(get_completion_scheduler<\exposid{completion-tag}>)}
10061008
is a core constant expression and has value \tcode{true}.
10071009

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+
10081026
\rSec1[exec.sched]{Schedulers}
10091027

10101028
\pnum
@@ -5442,6 +5460,13 @@
54425460
{ p.unhandled_stopped() } -> @\libconcept{convertible_to}@<coroutine_handle<>>;
54435461
};
54445462

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+
54455470
template<class Sndr, class Promise>
54465471
class @\exposidnc{sender-awaitable}@; // \expos
54475472
}
@@ -5583,6 +5608,13 @@
55835608
in a coroutine with promise type \tcode{U} is expression-equivalent to
55845609
the same expression in a coroutine with promise type \tcode{Promise}.
55855610
\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
55865618
Otherwise, \tcode{\exposid{sender-awaitable}\{expr, p\}}
55875619
if \tcode{\exposconcept{awaitable-sender}<Expr, Promise>} is \tcode{true}.
55885620
\item

source/support.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@
799799
#define @\defnlibxname{cpp_lib_saturation_arithmetic}@ 202311L // also in \libheader{numeric}
800800
#define @\defnlibxname{cpp_lib_scoped_lock}@ 201703L // also in \libheader{mutex}
801801
#define @\defnlibxname{cpp_lib_semaphore}@ 201907L // also in \libheader{semaphore}
802-
#define @\defnlibxname{cpp_lib_senders}@ 202406L // also in \libheader{execution}
802+
#define @\defnlibxname{cpp_lib_senders}@ 202506L // also in \libheader{execution}
803803
#define @\defnlibxname{cpp_lib_shared_mutex}@ 201505L // also in \libheader{shared_mutex}
804804
#define @\defnlibxname{cpp_lib_shared_ptr_arrays}@ 201707L // also in \libheader{memory}
805805
#define @\defnlibxname{cpp_lib_shared_ptr_weak_type}@ 201606L // also in \libheader{memory}

0 commit comments

Comments
 (0)