Debian Codegraph @

yo/coroutines/demo/recursive2/recursive/recursive.h

raw
1 #ifndef INCLUDED_RECURSIVE_
2 #define INCLUDED_RECURSIVE_
3
4 #include "../../promisebase/promisebase.h"
5
6 class Recursive
7 {
8 class State: public PromiseBase<Recursive, State>
9 {
10 using Handle = std::coroutine_handle<State>;
11
12 size_t d_value;
13
14 public:
15 std::suspend_always yield_value(size_t value);
16 size_t value() const;
17 };
18
19 private:
20 using Handle = std::coroutine_handle<State>;
21 Handle d_handle;
22
23 public:
24 using promise_type = State;
25
26 explicit Recursive(std::coroutine_handle<State> handle);
27 ~Recursive();
28
29 bool next(size_t *value);
30 };
31
32 inline Recursive::Recursive(std::coroutine_handle<State> handle)
33 :
34 d_handle(handle)
35 {}
36
37 #endif