1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>execution::submit</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="execution__start.html" title="execution::start"> 10<link rel="next" href="execution_context.html" title="execution_context"> 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="execution__start.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="execution_context.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.execution__submit"></a><a class="link" href="execution__submit.html" title="execution::submit">execution::submit</a> 28</h3></div></div></div> 29<p> 30 <a class="indexterm" name="boost_asio.indexterm.execution__submit"></a> 31A customisation point 32 that submits a sender to a receiver. 33 </p> 34<pre class="programlisting">constexpr unspecified submit = unspecified; 35</pre> 36<p> 37 The name <code class="computeroutput">execution::submit</code> denotes a customisation point object. 38 For some subexpressions <code class="computeroutput">s</code> and <code class="computeroutput">r</code>, let <code class="computeroutput">S</code> 39 be a type such that <code class="computeroutput">decltype((s))</code> is <code class="computeroutput">S</code> and let 40 <code class="computeroutput">R</code> be a type such that <code class="computeroutput">decltype((r))</code> is <code class="computeroutput">R</code>. 41 The expression <code class="computeroutput">execution::submit(s, r)</code> is ill-formed if <code class="computeroutput">sender_to<S, 42 R></code> is not <code class="computeroutput">true</code>. Otherwise, it is expression-equivalent 43 to: 44 </p> 45<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 46<li class="listitem"> 47 <code class="computeroutput">s.submit(r)</code>, if that expression is valid and <code class="computeroutput">S</code> 48 models <code class="computeroutput">sender</code>. If the function selected does not submit 49 the receiver object <code class="computeroutput">r</code> via the sender <code class="computeroutput">s</code>, the 50 program is ill-formed with no diagnostic required. 51 </li> 52<li class="listitem"> 53 Otherwise, <code class="computeroutput">submit(s, r)</code>, if that expression is valid and 54 <code class="computeroutput">S</code> models <code class="computeroutput">sender</code>, with overload resolution performed 55 in a context that includes the declaration <code class="computeroutput">void submit();</code> 56 and that does not include a declaration of <code class="computeroutput">execution::submit</code>. 57 If the function selected by overload resolution does not submit the receiver 58 object <code class="computeroutput">r</code> via the sender <code class="computeroutput">s</code>, the program is ill-formed 59 with no diagnostic required. 60 </li> 61<li class="listitem"> 62 Otherwise, <code class="computeroutput">execution::start((new submit_receiver<S, R>{s,r})->state_)</code>, 63 where <code class="computeroutput">submit_receiver</code> is an implementation-defined class 64 template equivalent to: 65 </li> 66</ul></div> 67<pre class="programlisting">template<class S, class R> 68 struct submit_receiver { 69 struct wrap { 70 submit_receiver * p_; 71 template<class...As> 72 requires receiver_of<R, As...> 73 void set_value(As&&... as) && 74 noexcept(is_nothrow_receiver_of_v<R, As...>) { 75 execution::set_value(std::move(p_->r_), (As&&) as...); 76 delete p_; 77 } 78 template<class E> 79 requires receiver<R, E> 80 void set_error(E&& e) && noexcept { 81 execution::set_error(std::move(p_->r_), (E&&) e); 82 delete p_; 83 } 84 void set_done() && noexcept { 85 execution::set_done(std::move(p_->r_)); 86 delete p_; 87 } 88 }; 89 remove_cvref_t<R> r_; 90 connect_result_t<S, wrap> state_; 91 submit_receiver(S&& s, R&& r) 92 : r_((R&&) r) 93 , state_(execution::connect((S&&) s, wrap{this})) {} 94 }; 95</pre> 96<h5> 97<a name="boost_asio.reference.execution__submit.h0"></a> 98 <span class="phrase"><a name="boost_asio.reference.execution__submit.requirements"></a></span><a class="link" href="execution__submit.html#boost_asio.reference.execution__submit.requirements">Requirements</a> 99 </h5> 100<p> 101 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/execution/submit.hpp</code> 102 </p> 103<p> 104 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio/execution.hpp</code> 105 </p> 106</div> 107<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 108<td align="left"></td> 109<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 110 Kohlhoff<p> 111 Distributed under the Boost Software License, Version 1.0. (See accompanying 112 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>) 113 </p> 114</div></td> 115</tr></table> 116<hr> 117<div class="spirit-nav"> 118<a accesskey="p" href="execution__start.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="execution_context.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 119</div> 120</body> 121</html> 122