enable-sender
should be a variable templateSection: 33.9.3 [exec.snd.concepts] Status: Ready Submitter: Eric Niebler Opened: 2025-02-03 Last modified: 2025-02-11
Priority: 1
View all issues with Ready status.
Discussion:
Imported from cplusplus/sender-receiver #305 and cplusplus/sender-receiver #306.
We require an opt-in to satisfy the sender
concept.
Making your type awaitable with an empty environment is one way to opt in.
If your awaitable requires an environment, you have two options:
sender_concept
typedef, orenable_sender
for your awaitable type.enable_sender
variable template was turned into
an exposition-only enable-sender
concept.
We should roll back that change.
[2025-02-07; Reflector poll]
Set priority to 1 after reflector poll.
[Hagenberg 2025-02-10; move to Ready]
Proposed resolution:
This wording is relative to N5001.
template<class Sndr> concept is-sender = // exposition only derived_from<typename Sndr::sender_concept, sender_t>; template<class Sndr> concept enable-sender = // exposition only is-sender<Sndr> || is-awaitable<Sndr, env-promise<empty_env>>; // [exec.awaitable] template<class Sndr> inline constexpr bool enable_sender = enable-sender<Sndr>; template<class Sndr> concept sender =
bool(enable-senderenable_sender<remove_cvref_t<Sndr>>)&& requires (const remove_cvref_t<Sndr>& sndr) { { get_env(sndr) } -> queryable; } && move_constructible<remove_cvref_t<Sndr>> && constructible_from<remove_cvref_t<Sndr>, Sndr>;…
-2- Given a subexpression
sndr
, […]-?- Remarks: Pursuant to 16.4.5.2.1 [namespace.std], users may specialize
enable_sender
totrue
for cv-unqualified program-defined types that modelsender
, andfalse
for types that do not. Such specializations shall be usable in constant expressions (7.7 [expr.const]) and have typeconst bool
.