tmp/tmpnanfn1iu/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Trivial awaitables <a id="coroutine.trivial.awaitables">[[coroutine.trivial.awaitables]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
struct suspend_never {
|
| 6 |
+
constexpr bool await_ready() const noexcept { return true; }
|
| 7 |
+
constexpr void await_suspend(coroutine_handle<>) const noexcept {}
|
| 8 |
+
constexpr void await_resume() const noexcept {}
|
| 9 |
+
};
|
| 10 |
+
struct suspend_always {
|
| 11 |
+
constexpr bool await_ready() const noexcept { return false; }
|
| 12 |
+
constexpr void await_suspend(coroutine_handle<>) const noexcept {}
|
| 13 |
+
constexpr void await_resume() const noexcept {}
|
| 14 |
+
};
|
| 15 |
+
}
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
[*Note 1*: The types `suspend_never` and `suspend_always` can be used
|
| 19 |
+
to indicate that an *await-expression* should either never suspend or
|
| 20 |
+
always suspend, and in either case not produce a value. — *end note*]
|
| 21 |
+
|