|
| 1 | +<?xml version='1.0' encoding='utf-8' standalone='no'?> |
| 2 | +<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
| 3 | + |
| 4 | +<issue num="4445" status="New"> |
| 5 | +<title>`sch_` must not be in moved-from state</title> |
| 6 | +<section> |
| 7 | +<sref ref="[exec.task.scheduler]"/> |
| 8 | +</section> |
| 9 | +<submitter>Tomasz Kamiński</submitter> |
| 10 | +<date>05 Nov 2025</date> |
| 11 | +<priority>99</priority> |
| 12 | + |
| 13 | +<discussion> |
| 14 | +<b>Addresses <a href="https://github.com/cplusplus/nbballot/issues/942">US 239-367</a></b> |
| 15 | +<p>As specified, there is an implicit precondition that `sch_` is not moved from on all the |
| 16 | +member functions. If that is intended, the precondition should be made explicit.</p> |
| 17 | +</discussion> |
| 18 | + |
| 19 | +<resolution> |
| 20 | +<p> |
| 21 | +This wording is relative to <paper num="N5014"/>. |
| 22 | +</p> |
| 23 | + |
| 24 | +<ol> |
| 25 | + |
| 26 | +<li><p>Modify <sref ref="[exec.task.scheduler]"/> as indicated:</p> |
| 27 | + |
| 28 | +<pre> |
| 29 | +namespace std::execution { |
| 30 | + class task_scheduler { |
| 31 | + class <i>ts-sender</i>; // exposition only |
| 32 | + |
| 33 | + template<receiver R> |
| 34 | + class state; // exposition only |
| 35 | + |
| 36 | + public: |
| 37 | + using scheduler_concept = scheduler_t; |
| 38 | + |
| 39 | + template<class Sch, class Allocator = allocator<void>> |
| 40 | + requires (!same_as<task_scheduler, remove_cvref_t<Sch>>) |
| 41 | + && scheduler<Sch> |
| 42 | + explicit task_scheduler(Sch&& sch, Allocator alloc = {}); |
| 43 | + |
| 44 | + <ins>task_scheduler(const task_scheduler&) = default;</ins> |
| 45 | + <ins>task_scheduler& operator=(const task_scheduler&) = default;</ins> |
| 46 | + |
| 47 | + <i>ts-sender</i> schedule(); |
| 48 | + |
| 49 | + friend bool operator==(const task_scheduler& lhs, const task_scheduler& rhs) |
| 50 | + noexcept; |
| 51 | + template<class Sch> |
| 52 | + requires (!same_as<task_scheduler, Sch>) |
| 53 | + && scheduler<Sch> |
| 54 | + friend bool operator==(const task_scheduler& lhs, const Sch& rhs) noexcept; |
| 55 | + |
| 56 | + private: |
| 57 | + shared_ptr<void> <i>sch_</i>; // exposition only |
| 58 | + }; |
| 59 | +} |
| 60 | +</pre> |
| 61 | +</li> |
| 62 | +</ol> |
| 63 | + |
| 64 | +</resolution> |
| 65 | + |
| 66 | +</issue> |
0 commit comments