Skip to content
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

restore the enable_sender boolean variable template #306

Open
ericniebler opened this issue Dec 5, 2024 · 1 comment
Open

restore the enable_sender boolean variable template #306

ericniebler opened this issue Dec 5, 2024 · 1 comment
Labels
bug Something isn't working P0 pending-wg21 A paper or an LWG issue exits

Comments

@ericniebler
Copy link
Collaborator

ericniebler commented Dec 5, 2024

as described in issue #305, enable_sender variable template was an important way to opt in to sender-ness, particularly for types that are awaitable, but only in certain contexts. this functionality was lost during wording review(?) when enable_sender got turned into an exposition-only enable-sender concept.

we should roll back that change.

Proposed resolution

Change [exec.snd.concepts] para 1 as follows:

  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-sender<remove_cvref_t<Sndr>>) &&
+     enable_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>;

we also need the standardese permitting users to specialize enable_sender. after [exec.snd.concepts] para 2, add a new paragraph as follows:

  1. 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.
@ericniebler ericniebler added bug Something isn't working P0 labels Dec 5, 2024
@ericniebler ericniebler added the needs-proposed-resolution This issue does not yet have a proposed resolution but needs one label Jan 21, 2025
@ericniebler ericniebler removed the needs-proposed-resolution This issue does not yet have a proposed resolution but needs one label Feb 2, 2025
@jwakely
Copy link
Member

jwakely commented Feb 3, 2025

Proposed resolution added https://cplusplus.github.io/LWG/issue4202

@ericniebler ericniebler added the pending-wg21 A paper or an LWG issue exits label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 pending-wg21 A paper or an LWG issue exits
Projects
None yet
Development

No branches or pull requests

2 participants