|
| 1 | +<?xml version='1.0' encoding='utf-8' standalone='no'?> |
| 2 | +<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
| 3 | + |
| 4 | +<issue num="4342" status="New"> |
| 5 | +<title>Missing rvalue reference qualification for <code>task_scheduler::ts-sender::connect()</code></title> |
| 6 | +<section><sref ref="[exec.task.scheduler]"/></section> |
| 7 | +<submitter>Dietmar Kühl</submitter> |
| 8 | +<date>01 Sep 2025</date> |
| 9 | +<priority>99</priority> |
| 10 | + |
| 11 | +<discussion> |
| 12 | +<p> |
| 13 | +The result of <code>schedule(sched)</code> for a scheduler |
| 14 | +<code>sched</code> is only required to be movable. An object of |
| 15 | +this type may need to be forwarded to an operation state constructor |
| 16 | +by <code>task_scheduler::<i>ts-sender</i>::connect</code>. Thus, |
| 17 | +this function should be qualified with an rvalue reference. |
| 18 | +</p> |
| 19 | +</discussion> |
| 20 | + |
| 21 | +<resolution> |
| 22 | +<p> |
| 23 | +Add an rvalue qualifier to the declaration of <code>connect</code> in <sref ref="[exec.task.scheduler]"/> paragraph 8: |
| 24 | +<blockquote> |
| 25 | +<pre> |
| 26 | +namespace std::execution { |
| 27 | + class task_scheduler::ts-sender { // exposition only |
| 28 | + public: |
| 29 | + using sender_concept = sender_t; |
| 30 | + |
| 31 | + template<receiver Rcvr> |
| 32 | + <i>state</i><Rcvr> connect(Rcvr&& rcvr)<ins> &&</ins>; |
| 33 | + }; |
| 34 | +} |
| 35 | +</pre> |
| 36 | +</blockquote> |
| 37 | +</p> |
| 38 | +<p> |
| 39 | +In the specification in <sref ref="[exec.task.scheduler]"/> paragraph 10 add an rvalue qualifier to <code>connect</code>: |
| 40 | +<blockquote> |
| 41 | +<pre> |
| 42 | +template<receiver Rcvr> |
| 43 | + <i>state</i><Rcvr> connect(Rcvr&& rcvr)<ins> &&</ins>; |
| 44 | +</pre> |
| 45 | +<p>-10- <i>Effects</i>: Let <i>r</i> be an object of a type that |
| 46 | +models receiver and whose completion handlers result in invoking |
| 47 | +the corresponding completion handlers of <code>rcvr</code> or copy thereof. |
| 48 | +Returns an object of type <code><i>state</i><Rcvr></code> containing an operation state |
| 49 | +object initialized with <code>connect(<i>SENDER</i>(*this), std::move(<i>r</i>))</code>. |
| 50 | +</p> |
| 51 | +</blockquote> |
| 52 | +</p> |
| 53 | +</resolution> |
| 54 | + |
| 55 | +</issue> |
0 commit comments