• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Sender concepts</title>
5<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../boost_asio.html" title="Boost.Asio">
8<link rel="up" href="../reference.html" title="Reference">
9<link rel="prev" href="Scheduler.html" title="Scheduler concept">
10<link rel="next" href="Service.html" title="Service requirements">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15<td align="center"><a href="../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="Scheduler.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Service.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_asio.reference.Sender"></a><a class="link" href="Sender.html" title="Sender concepts">Sender concepts</a>
28</h3></div></div></div>
29<h5>
30<a name="boost_asio.reference.Sender.h0"></a>
31        <span class="phrase"><a name="boost_asio.reference.Sender.sender_and_sender_to"></a></span><a class="link" href="Sender.html#boost_asio.reference.Sender.sender_and_sender_to">sender
32        and sender_to</a>
33      </h5>
34<pre class="programlisting">template&lt;class S&gt;
35  concept sender =
36    move_constructible&lt;remove_cvref_t&lt;S&gt;&gt; &amp;&amp;
37    !requires {
38      typename sender_traits&lt;remove_cvref_t&lt;S&gt;&gt;::__unspecialized; // exposition only
39    };
40
41template&lt;class S, class R&gt;
42  concept sender_to =
43    sender&lt;S&gt; &amp;&amp;
44    receiver&lt;R&gt; &amp;&amp;
45    requires (S&amp;&amp; s, R&amp;&amp; r) {
46      execution::connect((S&amp;&amp;) s, (R&amp;&amp;) r);
47    };
48</pre>
49<p>
50        None of these operations shall introduce data races as a result of concurrent
51        invocations of those functions from different threads.
52      </p>
53<p>
54        A sender type's destructor shall not block pending completion of the submitted
55        function objects.
56      </p>
57<p>
58        [<span class="emphasis"><em>Note:</em></span> The ability to wait for completion of submitted
59        function objects may be provided by the associated execution context. —<span class="emphasis"><em>end
60        note</em></span>]
61      </p>
62<h5>
63<a name="boost_asio.reference.Sender.h1"></a>
64        <span class="phrase"><a name="boost_asio.reference.Sender.typed_sender"></a></span><a class="link" href="Sender.html#boost_asio.reference.Sender.typed_sender">typed_sender</a>
65      </h5>
66<p>
67        A sender is <span class="bold"><strong>typed</strong></span> if it declares what types
68        it sends through a receiver's channels. The <code class="computeroutput">typed_sender</code> concept
69        is defined as:
70      </p>
71<pre class="programlisting">template&lt;template&lt;template&lt;class...&gt; class Tuple, template&lt;class...&gt; class Variant&gt; class&gt;
72  struct has-value-types; // exposition only
73
74template&lt;template&lt;class...&gt; class Variant&gt;
75  struct has-error-types; // exposition only
76
77template&lt;class S&gt;
78  concept has-sender-types = // exposition only
79    requires {
80      typename has-value-types&lt;S::template value_types&gt;;
81      typename has-error-types&lt;S::template error_types&gt;;
82      typename bool_constant&lt;S::sends_done&gt;;
83    };
84
85template&lt;class S&gt;
86  concept typed_sender =
87    sender&lt;S&gt; &amp;&amp;
88    has-sender-types&lt;sender_traits&lt;remove_cvref_t&lt;S&gt;&gt;&gt;;
89</pre>
90</div>
91<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
92<td align="left"></td>
93<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
94      Kohlhoff<p>
95        Distributed under the Boost Software License, Version 1.0. (See accompanying
96        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
97      </p>
98</div></td>
99</tr></table>
100<hr>
101<div class="spirit-nav">
102<a accesskey="p" href="Scheduler.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="Service.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
103</div>
104</body>
105</html>
106