A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cplusplus/sender-receiver/issues/306 below:

restore the `enable_sender` boolean variable template · Issue #306 · cplusplus/sender-receiver · GitHub

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.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4