|
| 1 | +# scheduler |
| 2 | +* execution[meta header] |
| 3 | +* concept[meta id-type] |
| 4 | +* std::execution[meta namespace] |
| 5 | +* cpp26[meta cpp] |
| 6 | + |
| 7 | +```cpp |
| 8 | +namespace std::execution { |
| 9 | + template<class Sch> |
| 10 | + concept scheduler = |
| 11 | + derived_from<typename remove_cvref_t<Sch>::scheduler_concept, scheduler_t> && |
| 12 | + queryable<Sch> && |
| 13 | + requires(Sch&& sch) { |
| 14 | + { schedule(std::forward<Sch>(sch)) } -> sender; |
| 15 | + { auto(get_completion_scheduler<set_value_t>( |
| 16 | + get_env(schedule(std::forward<Sch>(sch))))) } |
| 17 | + -> same_as<remove_cvref_t<Sch>>; |
| 18 | + } && |
| 19 | + equality_comparable<remove_cvref_t<Sch>> && |
| 20 | + copyable<remove_cvref_t<Sch>>; |
| 21 | + |
| 22 | + struct scheduler_t {}; // タグ型 |
| 23 | +} |
| 24 | +``` |
| 25 | +* derived_from[link /reference/concepts/derived_from.md] |
| 26 | +* queryable[link queryable.md.nolink] |
| 27 | +* get_completion_scheduler[link get_completion_scheduler.md.nolink] |
| 28 | +* get_env[link get_env.md.nolink] |
| 29 | +* equality_comparable[link /reference/concepts/equality_comparable.md] |
| 30 | +* copyable[link /reference/concepts/copyable.md] |
| 31 | +
|
| 32 | +## 概要 |
| 33 | +`scheduler`は、型`Sch`がScheduler型の要件を満たすことを表すコンセプトである。 |
| 34 | +
|
| 35 | +下記をみたすクラス型はSchedulerとみなせる。 |
| 36 | +
|
| 37 | +- `scheduler_t`をメンバ型`Sch::scheduler_concept`として定義するクラス型 |
| 38 | +- [問い合わせ可能](queryable.md.nolink)であること |
| 39 | +- `Sch`型の値`sch`に対して下記が有効な式であること |
| 40 | + - [`execution::schedule`](schedule.md.nolink)`(sch)`が[Sender](sender.md)を返すこと |
| 41 | + - [`execution::get_completion_scheduler`](get_completion_scheduler.md.nolink)`<set_value_t>(`[`execution::get_env`](get_env.md.nolink)`(`[`execution::schedule`](schedule.md.nolink)`(sch)))`の結果が`Sch`型に等しいこと |
| 42 | +
|
| 43 | +
|
| 44 | +## 例 |
| 45 | +```cpp example |
| 46 | +#include <execution> |
| 47 | +namespace ex = std::execution; |
| 48 | +
|
| 49 | +int main() |
| 50 | +{ |
| 51 | + ex::run_loop loop; |
| 52 | + ex::scheduler auto sch = loop.get_scheduler(); |
| 53 | +} |
| 54 | +``` |
| 55 | +* ex::scheduler[color ff0000] |
| 56 | +* ex::run_loop[link run_loop.md.nolink] |
| 57 | +* get_scheduler()[link run_loop/get_scheduler.md.nolink] |
| 58 | + |
| 59 | +### 出力 |
| 60 | +``` |
| 61 | +``` |
| 62 | + |
| 63 | + |
| 64 | +## バージョン |
| 65 | +### 言語 |
| 66 | +- C++26 |
| 67 | + |
| 68 | +### 処理系 |
| 69 | +- [Clang](/implementation.md#clang): ?? |
| 70 | +- [GCC](/implementation.md#gcc): ?? |
| 71 | +- [ICC](/implementation.md#icc): ?? |
| 72 | +- [Visual C++](/implementation.md#visual_cpp): ?? |
| 73 | + |
| 74 | + |
| 75 | +## 関連項目 |
| 76 | +- [`execution::schedule`](schedule.md.nolink) |
| 77 | + |
| 78 | + |
| 79 | +## 参照 |
| 80 | +- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html) |
0 commit comments