| 1 |
#ifndef INCLUDED_START_ |
| 2 |
#define INCLUDED_START_ |
| 3 |
|
| 4 |
#include "../../promisebase/promisebase.h" |
| 5 |
#include "../awaiter/awaiter.h" |
| 6 |
|
| 7 |
#include "../letter/letter.h" |
| 8 |
#include "../digit/digit.h" |
| 9 |
#include "../done/done.h" |
| 10 |
|
| 11 |
// no operator co_await -> Start is the Awaiter |
| 12 |
|
| 13 |
//start |
| 14 |
class Start: public Awaiter |
| 15 |
{ |
| 16 |
struct State: public PromiseBase<Start, State> |
| 17 |
{}; |
| 18 |
|
| 19 |
std::coroutine_handle<State> d_handle; |
| 20 |
|
| 21 |
public: |
| 22 |
using promise_type = State; |
| 23 |
using Handle = std::coroutine_handle<State>; |
| 24 |
|
| 25 |
explicit Start(Handle handle); |
| 26 |
~Start(); |
| 27 |
|
| 28 |
void go(); |
| 29 |
|
| 30 |
// this and the members in Awaiter are required for Awaiters |
| 31 |
template <typename HandleType> |
| 32 |
std::coroutine_handle<State> await_suspend(HandleType &handle); |
| 33 |
}; |
| 34 |
|
| 35 |
template <typename HandleType> |
| 36 |
inline std::coroutine_handle<Start::State> |
| 37 |
Start::await_suspend(HandleType &handle) |
| 38 |
{ |
| 39 |
return d_handle; |
| 40 |
} |
| 41 |
//= |
| 42 |
|
| 43 |
extern Start g_start; |
| 44 |
|
| 45 |
#endif |