Debian Codegraph @

yo/coroutines/demo/fsa/done/done.h

raw
1 #ifndef INCLUDED_DONE_
2 #define INCLUDED_DONE_
3
4 #include "../../promisebase/promisebase.h"
5 #include "../awaiter/awaiter.h"
6
7 class Done: public Awaiter
8 {
9 struct State: public PromiseBase<Done, State>
10 {};
11
12 std::coroutine_handle<State> d_handle;
13 static size_t s_count;
14
15 public:
16 using promise_type = State;
17 using Handle = std::coroutine_handle<State>;
18
19 explicit Done(Handle handle);
20 ~Done();
21
22 template <typename HandleType>
23 std::coroutine_handle<State> await_suspend(HandleType const &handle);
24 };
25
26 template <typename HandleType>
27 inline std::coroutine_handle<Done::State> Done::await_suspend(
28 HandleType const &handle)
29 {
30 return d_handle;
31 }
32
33 extern Done g_done;
34
35 #endif