Skip to content

P3570R2 optional variants in sender/receiver #8003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions source/exec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
struct @\libglobal{get_forward_progress_guarantee_t}@ { @\unspec@ };
template<class CPO>
struct @\libglobal{get_completion_scheduler_t}@ { @\unspec@ };
struct get_await_completion_adaptor_t { @\unspec@ };

inline constexpr get_domain_t @\libglobal{get_domain}@{};
inline constexpr get_scheduler_t @\libglobal{get_scheduler}@{};
Expand All @@ -472,6 +473,7 @@
inline constexpr get_forward_progress_guarantee_t @\libglobal{get_forward_progress_guarantee}@{};
template<class CPO>
constexpr get_completion_scheduler_t<CPO> @\libglobal{get_completion_scheduler}@{};
inline constexpr get_await_completion_adaptor_t get_await_completion_adaptor{};

struct @\libglobal{get_env_t}@ { @\unspec@ };
inline constexpr get_env_t @\libglobal{get_env}@{};
Expand Down Expand Up @@ -1005,6 +1007,22 @@
\tcode{forwarding_query(get_completion_scheduler<\exposid{completion-tag}>)}
is a core constant expression and has value \tcode{true}.

\rSec2[exec.get.await.adapt]{\tcode{execution::get_await_completion_adaptor}}

\pnum
\tcode{get_await_completion_adaptor} asks a queryable object for
its associated awaitable completion adaptor.

\pnum
The name \tcode{get_await_completion_adaptor} denotes a query object.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably resolve the overfull hbox issues in this area by sprinkling some soft hyphens (\-) into these long identifiers.

For a subexpression \tcode{env},
\tcode{get_await_completion_adaptor(env)} is expression-equivalent to
\tcode{\exposid{MANDATE-NOTHROW}(\exposid{AS-CONST}(env).query(get_await_completion_adaptor))}.

\pnum
\tcode{forwarding_query(execution::get_await_completion_adaptor)}
is a core constant expression and has value \tcode{true}.

\rSec1[exec.sched]{Schedulers}

\pnum
Expand Down Expand Up @@ -5442,6 +5460,13 @@
{ p.unhandled_stopped() } -> @\libconcept{convertible_to}@<coroutine_handle<>>;
};

template<class Sndr>
concept @\defexposconcept{has-queryable-await-completion-adaptor}@ = // \expos
@\libconcept{sender}@<Sndr> &&
requires(Sndr&& sender) {
get_await_completion_adaptor(get_env(sender));
};

template<class Sndr, class Promise>
class @\exposidnc{sender-awaitable}@; // \expos
}
Expand Down Expand Up @@ -5583,6 +5608,13 @@
in a coroutine with promise type \tcode{U} is expression-equivalent to
the same expression in a coroutine with promise type \tcode{Promise}.
\item
Otherwise, \tcode{\exposid{sender-awaitable}\{\exposid{adapted-expr}, p\}}
if \tcode{\exposid{has-queryable-await-completion-adaptor}<Expr>}
and \tcode{\exposid{awaitable-sender}<decltype((\exposid{adapted-expr})), Promise>}
are both satisfied, where \exposid{adapted-expr} is
\tcode{get_await_completion_adaptor(get_env(expr))(expr)},
except that \tcode{expr} is evaluated only once.
Comment on lines +5611 to +5616
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sprinkling in some soft hyphens (\-) into names and optional word breaks (\brk{}) after opening parentheses and punctuation should do the trick here.

\item
Otherwise, \tcode{\exposid{sender-awaitable}\{expr, p\}}
if \tcode{\exposconcept{awaitable-sender}<Expr, Promise>} is \tcode{true}.
\item
Expand Down
2 changes: 1 addition & 1 deletion source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@
#define @\defnlibxname{cpp_lib_saturation_arithmetic}@ 202311L // also in \libheader{numeric}
#define @\defnlibxname{cpp_lib_scoped_lock}@ 201703L // also in \libheader{mutex}
#define @\defnlibxname{cpp_lib_semaphore}@ 201907L // also in \libheader{semaphore}
#define @\defnlibxname{cpp_lib_senders}@ 202406L // also in \libheader{execution}
#define @\defnlibxname{cpp_lib_senders}@ 202506L // also in \libheader{execution}
#define @\defnlibxname{cpp_lib_shared_mutex}@ 201505L // also in \libheader{shared_mutex}
#define @\defnlibxname{cpp_lib_shared_ptr_arrays}@ 201707L // also in \libheader{memory}
#define @\defnlibxname{cpp_lib_shared_ptr_weak_type}@ 201606L // also in \libheader{memory}
Expand Down
Loading