yo/coroutines/demo/coroiter/recursive/iterator.cc
raw| 1 | #include "recursive.ih" |
| 2 | |
| 3 | //iter |
| 4 | size_t Recursive::Iterator::operator*() const |
| 5 | { |
| 6 | return d_handle.promise().value(); |
| 7 | } |
| 8 | |
| 9 | Recursive::Iterator &Recursive::Iterator::operator++() |
| 10 | { |
| 11 | d_handle.resume(); |
| 12 | |
| 13 | if (d_handle.done()) |
| 14 | d_handle = 0; |
| 15 | |
| 16 | return *this; |
| 17 | } |
| 18 | //= |
| 19 | |
| 20 | //cons |
| 21 | Recursive::Iterator::Iterator(Handle handle) |
| 22 | : |
| 23 | d_handle(handle) |
| 24 | {} |
| 25 | //= |