File tree Expand file tree Collapse file tree 2 files changed +67
-1
lines changed Expand file tree Collapse file tree 2 files changed +67
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ struct env-promise : with-await-transform<env-promise<Env>> {
4747 const Env& get_env() const noexcept;
4848};
4949```
50- * is-awaitable[ link is-awaitable.md.nolink ]
50+ * is-awaitable[ link ../ is-awaitable.md]
5151* env<>[ link env.md.nolink]
5252* derived_from[ link /reference/concepts/derived_from.md]
5353* coroutine_handle<>[ link /reference/coroutine/coroutine_handle.md]
Original file line number Diff line number Diff line change 1+ # is-awaitable
2+ * execution[ meta header]
3+ * concept[ meta id-type]
4+ * std[ meta namespace]
5+ * cpp26[ meta cpp]
6+
7+ ``` cpp
8+ template <class C , class Promise>
9+ concept is-awaitable;
10+ ```
11+
12+ ## 概要
13+ `is-awaitable`は、Promise型をもつ[コルーチンのco_await演算子](/lang/cpp20/coroutines.md)オペランドにおいて`C`型オブジェクトが妥当であることを表す説明専用コンセプトである。
14+
15+
16+ ## 要件
17+ 説明用の式`GET-AWAITER(c, p)`を、Promise型`p`をもつコルーチン内の`co_await`演算子オペランドに適用される一連変換後の左辺値とする。
18+
19+ - (有効ならば)Promise型の`await_transform`メンバ関数を適用
20+ - (有効ならば)`co_await`演算子オーバーロードを適用
21+
22+ また、説明用のコンセプト`await-suspend-result`, `is-awaiter`を以下のように定義する。
23+
24+ ```cpp
25+ template<class T>
26+ concept await-suspend-result = /*see below*/;
27+
28+ template<class A, class Promise>
29+ concept is-awaiter =
30+ requires (A& a, coroutine_handle<Promise> h) {
31+ a.await_ready() ? 1 : 0;
32+ { a.await_suspend(h) } -> await-suspend-result;
33+ a.await_resume();
34+ };
35+ ```
36+ * coroutine_handle[ link /reference/coroutine/coroutine_handle.md]
37+
38+ 下記いずれかのうち1つが` true ` のとき、` await-suspend-result<T> ` は` true ` となる。
39+
40+ - ` T ` が` void ` 、もしくは
41+ - ` T ` が` bool ` 、もしくは
42+ - ` T ` が[ ` coroutine_handle ` ] ( /reference/coroutine/coroutine_handle.md ) の特殊化
43+
44+ ` is-awaitable ` コンセプトは、以下のように定義される。
45+
46+ ``` cpp
47+ template <class C , class Promise>
48+ concept is-awaitable =
49+ requires (C (* fc)() noexcept, Promise& p) {
50+ { GET-AWAITER(fc(), p) } -> is-awaiter<Promise >;
51+ };
52+ ```
53+ * GET-AWAITER[italic]
54+
55+
56+ ## バージョン
57+ ### 言語
58+ - C++26
59+
60+
61+ ## 関連項目
62+ - [コルーチン](/lang/cpp20/coroutines.md)
63+
64+
65+ ## 参照
66+ - [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
You can’t perform that action at this time.
0 commit comments