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

arm-ehcleanup-dtorsjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since 8f936bf was 8f936bf, checked in by tdelisle <tdelisle@…>, 3 years ago

Got rid of weird yield in fmt example

  • Property mode set to 100644
File size: 732 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
20co_yield i;
21
22//   |  |
23//   |  |
24//  \    /
25//   \  /
26//    \/
27
28co_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.