yo/coroutines/demo/recursive/recursivecoro.1
raw| 1 | namespace |
| 2 | { |
| 3 | size_t s_value = 0; |
| 4 | } |
| 5 | |
| 6 | Recursive recursiveCoro(bool recurse) |
| 7 | { |
| 8 | while (true) |
| 9 | { |
| 10 | for (size_t idx = 0; idx != 2; ++idx) |
| 11 | co_yield ++s_value; |
| 12 | |
| 13 | // here recursiveCoro will recursively be called |
| 14 | |
| 15 | for (size_t idx = 0; idx != 2; ++idx) |
| 16 | co_yield ++s_value; |
| 17 | } |
| 18 | } |