• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2 / Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
3 /
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 /]
7
8[section:Sender Sender concepts]
9
10[heading sender and sender_to]
11
12    template<class S>
13      concept sender =
14        move_constructible<remove_cvref_t<S>> &&
15        !requires {
16          typename sender_traits<remove_cvref_t<S>>::__unspecialized; // exposition only
17        };
18
19    template<class S, class R>
20      concept sender_to =
21        sender<S> &&
22        receiver<R> &&
23        requires (S&& s, R&& r) {
24          execution::connect((S&&) s, (R&&) r);
25        };
26
27None of these operations shall introduce data races as a result of concurrent
28invocations of those functions from different threads.
29
30A sender type's destructor shall not block pending completion of the submitted
31function objects.
32
33[inline_note The ability to wait for completion of submitted function objects
34may be provided by the associated execution context.]
35
36[heading typed_sender]
37
38A sender is [*typed] if it declares what types it sends through a receiver's
39channels. The `typed_sender` concept is defined as:
40
41    template<template<template<class...> class Tuple, template<class...> class Variant> class>
42      struct has-value-types; // exposition only
43
44    template<template<class...> class Variant>
45      struct has-error-types; // exposition only
46
47    template<class S>
48      concept has-sender-types = // exposition only
49        requires {
50          typename has-value-types<S::template value_types>;
51          typename has-error-types<S::template error_types>;
52          typename bool_constant<S::sends_done>;
53        };
54
55    template<class S>
56      concept typed_sender =
57        sender<S> &&
58        has-sender-types<sender_traits<remove_cvref_t<S>>>;
59
60[endsect]
61