From e1391646fad2b404e9705a129aeb72a61bcb01ee Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Sat, 9 Dec 2023 16:28:20 -0800 Subject: [PATCH] rename is_sender/is_receiver to sender_concept/receiver_concept by request from LEWG --- execution.bs | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/execution.bs b/execution.bs index 151ff9e..ada1828 100644 --- a/execution.bs +++ b/execution.bs @@ -429,7 +429,7 @@ struct recv_op : operation_base { }; struct recv_sender { - using is_sender = void; + using sender_concept = std::execution::sender_t; SOCKET sock; void* data; size_t len; @@ -533,7 +533,7 @@ class _then_receiver template struct _then_sender { - using is_sender = void; + using sender_concept = exec::sender_t; S s_; F f_; @@ -656,7 +656,7 @@ struct _op { template struct _retry_sender { - using is_sender = void; + using sender_concept = exec::sender_t; S s_; explicit _retry_sender(S s) : s_((S&&) s) {} @@ -746,7 +746,7 @@ class inline_scheduler { }; struct _sender { - using is_sender = void; + using sender_concept = std::execution::sender_t; using completion_signatures = std::execution::completion_signatures; @@ -1148,9 +1148,15 @@ The changes since R7 are as follows: * The `sender_in` concept requires that `E` satisfies `queryable`. +Enhancements: + * The exposition-only class template basic-sender is greatly enhanced, and the sender algorithms are respecified in term of it. + * `enable_sender` and `enable_receiver` traits now have default + implementations that look for nested `sender_concept` and `receiver_concept` + types, respectively. + ## R7 ## {#r7} The changes since R6 are as follows: @@ -4137,6 +4143,8 @@ namespace std::execution { concept scheduler = see-below; // [exec.recv], receivers + struct receiver_t {}; + template<class R> inline constexpr bool enable_receiver = see-below; @@ -4169,6 +4177,8 @@ namespace std::execution { inline constexpr start_t start{}; // [exec.snd], senders + struct sender_t {}; + template<class S> inline constexpr bool enable_sender = see below; @@ -4712,10 +4722,11 @@ enum class forward_progress_guarantee {
     template<class R>
-      inline constexpr bool enable_receiver =
-        requires {
-          typename R::is_receiver;
-        };
+      concept is-receiver = // exposition only
+        derived_from<typename R::receiver_concept, receiver_t>;
+
+    template<class R>
+      inline constexpr bool enable_receiver = is-receiver<R>;
 
     template<class R>
       concept receiver =
@@ -5208,11 +5219,14 @@ enum class forward_progress_guarantee {
 
     
     template<class Sigs>
-      concept valid-completion-signatures = see below;
+      concept valid-completion-signatures = see below; // exposition only
+
+    template<class S>
+      concept is-sender = // exposition only
+        derived_from<typename S::sender_concept, sender_t>;
 
     template<class S>
-      inline constexpr bool enable_sender =
-        requires { typename S::is_sender; };
+      inline constexpr bool enable_sender = is-sender<S>;
 
     template<is-awaitable<env-promise<empty_env>> S> // [exec.awaitables]
       inline constexpr bool enable_sender<S> = true;
@@ -5731,7 +5745,7 @@ template<class Domain, class Tag, sender Sender, class... Args>
     
     template<class Tag, movable-value... Ts> // arguments are not associated entities ([lib.tmpl-heads])
     struct just-sender { // exposition only
-      using is_sender = unspecified;
+      using sender_concept = sender_t;
       using completion_signatures =
         execution::completion_signatures<Tag(Ts...)>;
 
@@ -5805,7 +5819,7 @@ template<class Domain, class Tag, sender Sender, class... Args>
     
     template<class Tag>
       struct read-sender { // exposition only
-        using is_sender = unspecified;
+        using sender_concept = sender_t;
         template<class R>
           struct operation-state { // exposition only
             R r_; // exposition only
@@ -6937,7 +6951,7 @@ template<class Domain, class Tag, sender Sender, class... Args>
 
     
     struct detached-receiver {
-      using is_receiver = unspecified;
+      using receiver_concept = receiver_t;
       detached-operation* op; // exposition only
 
       friend void tag_invoke(set_value_t, detached-receiver&& self) noexcept { delete self.op; }
@@ -7103,7 +7117,7 @@ template<class Domain, class Tag, sender Sender, class... Args>
     class receiver_adaptor {
       friend Derived;
      public:
-      using is_receiver = unspecified;
+      using receiver_concept = receiver_t;
 
       // Constructors
       receiver_adaptor() = default;
@@ -7666,7 +7680,7 @@ template<class Domain, class Tag, sender Sender, class... Args>
 
             
             struct awaitable-receiver {
-              using is_receiver = unspecified;
+              using receiver_concept = receiver_t;
               variant<monostate, result_t, exception_ptr>* result_ptr_;
               coroutine_handle<P> continuation_;
               // ... see below