source: doc/papers/concurrency/c++-cor/C++Cor-ts.cpp @ 81a05ca

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 81a05ca was be3416d, checked in by tdelisle <tdelisle@…>, 5 years ago

Added more examples of c++20 coroutines

  • Property mode set to 100644
File size: 398 bytes
Line 
1
2
3auto result = co_await expression;
4
5//   |  |
6//   |  |
7//  \    /
8//   \  /
9//    \/
10
11auto&& __a = expression;
12if (!__a.await_ready()) {
13        __a.await_suspend(coroutine-handle)
14        // ...suspend/resume point...
15}
16auto result = __a.await_resume();
17
18//==================================================
19
20
21co_yield i;
22
23//   |  |
24//   |  |
25//  \    /
26//   \  /
27//    \/
28
29co_await __promise.yield_value(i);
Note: See TracBrowser for help on using the repository browser.