Title
enable-sender should be a variable template
Status
ready
Section
[exec.snd.concepts]
Submitter
Eric Niebler

Created on 2025-02-03.00:00:00 last changed 2 months ago

Messages

Date: 2025-02-11.17:35:18

Proposed resolution:

This wording is relative to N5001.

  1. Change [exec.snd.concepts] as indicated:
    
      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 [namespace.std], users may specialize `enable_sender` to `true` for cv-unqualified program-defined types that model `sender`, and `false` for types that do not. Such specializations shall be usable in constant expressions ([expr.const]) and have type `const bool`.

Date: 2025-02-11.17:35:18

[ Hagenberg 2025-02-11; move to Ready ]

Date: 2025-02-15.00:00:00

[ 2025-02-07; Reflector poll ]

Set priority to 1 after reflector poll.

Date: 2025-02-03.18:49:08

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:

  • give your awaitable type a nested `sender_concept` typedef, or
  • specialize `enable_sender` for your awaitable type.
The problem is that somewhere along the way, the `enable_sender` variable template was turned into an exposition-only enable-sender concept. We should roll back that change.

History
Date User Action Args
2025-02-11 17:35:18adminsetmessages: + msg14632
2025-02-11 17:35:18adminsetstatus: new -> ready
2025-02-07 20:50:56adminsetmessages: + msg14595
2025-02-03 18:49:08adminsetmessages: + msg14567
2025-02-03 00:00:00admincreate