You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Blocks the calling thread to wait for the passed sender to complete. Returns <code>T</code> when passed a <code>typed_sender</code> that sends a <code>T</code> on the value channel, where <code>T</code> may be <code>void</code>, throws if an exception is propagated and calls <code>std::terminate</code> on propagation of the <code>set_done()</code> signal.</p>
<p><code>transform</code> is a sender adapter that takes a <code>sender</code> and an invocable and returns a <code>sender</code> that propagates the value resulting from calling the invocable on the value passed by the preceding <code>sender</code>.</p>
<spanid="cb23-2"><ahref="#cb23-2"></a>see<spanclass="op">-</span>below transform<spanclass="op">(</span>S s, F f<spanclass="op">)</span>;</span></code></pre></div>
<spanid="cb23-3"><ahref="#cb23-3"></a>see<spanclass="op">-</span>below transform<spanclass="op">(</span>S s, F f<spanclass="op">)</span>;</span></code></pre></div>
970
971
<p><em>[ Example:</em></p>
971
-
<divclass="sourceCode" id="cb24"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb24-1"><ahref="#cb24-1"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">int</span><spanclass="op">></span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span>just<spanclass="op">(</span><spanclass="dv">3</span><spanclass="op">)</span><spanclass="op">|</span> transform<spanclass="op">([](</span><spanclass="dt">int</span> v<spanclass="op">){</span><spanclass="cf">return</span> v<spanclass="op">+</span><spanclass="dv">1</span>;<spanclass="op">}))</span>;</span>
972
+
<divclass="sourceCode" id="cb24"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb24-1"><ahref="#cb24-1"></a><spanclass="dt">int</span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span>just<spanclass="op">(</span><spanclass="dv">3</span><spanclass="op">)</span><spanclass="op">|</span> transform<spanclass="op">([](</span><spanclass="dt">int</span> v<spanclass="op">){</span><spanclass="cf">return</span> v<spanclass="op">+</span><spanclass="dv">1</span>;<spanclass="op">}))</span>;</span>
<p><code>let_error</code> is a sender adapter that takes a <code>sender</code> and an invocable and returns a <code>sender</code> that, on error propagation, keeps the error result of the incoming sender alive for the duration of the <code>sender</code> returned by the invocable and makes that value available to the invocable.</p>
<spanid="cb26-2"><ahref="#cb26-2"></a>see<spanclass="op">-</span>below let_error<spanclass="op">(</span>S s, F f<spanclass="op">)</span>;</span></code></pre></div>
<spanid="cb26-10"><ahref="#cb26-10"></a>see<spanclass="op">-</span>below let_error<spanclass="op">(</span>S s, F f<spanclass="op">)</span>;</span></code></pre></div>
1048
1057
<p><em>[ Example:</em></p>
1049
-
<divclass="sourceCode" id="cb27"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb27-1"><ahref="#cb27-1"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">float</span><spanclass="op">></span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span></span>
1058
+
<divclass="sourceCode" id="cb27"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb27-1"><ahref="#cb27-1"></a><spanclass="dt">float</span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span></span>
<spanid="cb30-4"><ahref="#cb30-4"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">int</span><spanclass="op">></span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span></span>
1101
+
<spanid="cb30-4"><ahref="#cb30-4"></a><spanclass="dt">int</span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span></span>
<spanid="cb30-7"><ahref="#cb30-7"></a><spanclass="op">[](</span><spanclass="dt">int</span> a, <spanclass="dt">int</span> b<spanclass="op">){</span><spanclass="cf">return</span> a<spanclass="op">+</span>b;<spanclass="op">}))</span>;</span>
<p><code>let_value</code> is a sender adapter that takes a <code>sender</code> and an invocable and returns a <code>sender</code> that keeps the completion result of the incoming sender alive for the duration of the algorithm returned by the invocable and makes that value available to the invocable.</p>
<spanid="cb32-2"><ahref="#cb32-2"></a>see<spanclass="op">-</span>below let_value<spanclass="op">(</span>S s, F f<spanclass="op">)</span>;</span></code></pre></div>
<spanid="cb32-10"><ahref="#cb32-10"></a>see<spanclass="op">-</span>below let_value<spanclass="op">(</span>S s, F f<spanclass="op">)</span>;</span></code></pre></div>
1126
1143
<p>where <code>S<T...></code> and <code>S<T2></code> are implementation-defined types that is represent senders that send a value of type list <code>T...</code> or <code>T2</code> respectively in their value channels. Note that in the general case there may be many types <code>T...</code> for a given <code>sender</code>, in which case the invocable may have to represent an overload set.</p>
1127
1144
<p><em>[ Example:</em></p>
1128
-
<divclass="sourceCode" id="cb33"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb33-1"><ahref="#cb33-1"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">int</span><spanclass="op">></span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span></span>
1145
+
<divclass="sourceCode" id="cb33"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb33-1"><ahref="#cb33-1"></a><spanclass="dt">int</span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span></span>
<spanid="cb35-7"><ahref="#cb35-7"></a>std::optional<int> r = sync_wait(s);</span></code></pre></div>
1181
+
<spanid="cb35-7"><ahref="#cb35-7"></a>int r = sync_wait(s);</span></code></pre></div>
1165
1182
<p>The result of <code>s1</code> might be a <code>just_sender<int></code> implemented by the standard library vendor.</p>
1166
1183
<p><code>on(just_sender<int>, scheduler1)</code> has no customization defined, and this expression returns an <code>scheduler1_on_sender<int></code> that is a custom type from the author of <code>scheduler1</code>, it will call <code>submit</code> on the result of <code>s1</code>.</p>
1167
1184
<p><code>s3</code> calls <code>transform(scheduler1_on_sender<int>, [](int a){return a+1;})</code> for which the author of <code>scheduler1</code> may have written a customization. The <code>scheduler1_on_sender</code> has stashed the value somewhere and build some work queue in the background. We do not see <code>submit</code> called at this point, it uses a behind-the-scenes implementation to schedule the work on the work queue. An <code>scheduler1_transform_sender<int></code> is returned.</p>
0 commit comments