ADTast-experimentalenumforall-pointer-decaypthread-emulationqualifiedEnum
Last change
on this file since 86530e7 was
aa22c60,
checked in by tdelisle <tdelisle@…>, 6 years ago
|
Moved c++Cor example to examples folder
|
-
Property mode set to
100644
|
File size:
732 bytes
|
Rev | Line | |
---|
[be3416d] | 1 | |
---|
| 2 | |
---|
| 3 | auto result = co_await expression; |
---|
| 4 | |
---|
| 5 | // | | |
---|
| 6 | // | | |
---|
| 7 | // \ / |
---|
| 8 | // \ / |
---|
| 9 | // \/ |
---|
| 10 | |
---|
| 11 | auto&& __a = expression; |
---|
| 12 | if (!__a.await_ready()) { |
---|
| 13 | __a.await_suspend(coroutine-handle) |
---|
| 14 | // ...suspend/resume point... |
---|
| 15 | } |
---|
| 16 | auto result = __a.await_resume(); |
---|
| 17 | |
---|
| 18 | //================================================== |
---|
| 19 | |
---|
| 20 | co_yield i; |
---|
| 21 | |
---|
| 22 | // | | |
---|
| 23 | // | | |
---|
| 24 | // \ / |
---|
| 25 | // \ / |
---|
| 26 | // \/ |
---|
| 27 | |
---|
[8f936bf] | 28 | co_await __promise.yield_value(i); |
---|
| 29 | |
---|
| 30 | //================================================== |
---|
| 31 | |
---|
| 32 | ... coroutine() { |
---|
| 33 | __coroutine_context* __context = new __coroutine_context{}; |
---|
| 34 | __return = __context->_promise.get_return_object(); |
---|
| 35 | co_await __context->_promise.initial_suspend(); |
---|
| 36 | |
---|
| 37 | ... |
---|
| 38 | |
---|
| 39 | __final_suspend_label: |
---|
| 40 | co_await __context->promise.final_suspend(); |
---|
| 41 | delete __context; |
---|
| 42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.