MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / my_resumable

Class my_resumable

tests/EduCoroutineCaptureThisTest.cpp:9–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7struct ClassWithCoro;
8
9struct my_resumable {
10 struct promise_type {
11 promise_type(ClassWithCoro& q1, int& q2) {}
12 my_resumable get_return_object() {
13 return my_resumable(my_resumable::handle_type::from_promise(*this));
14 }
15 std::suspend_never initial_suspend() { return {}; }
16 std::suspend_always final_suspend() noexcept { return {}; }
17 void return_value(int) {}
18 void unhandled_exception() {}
19 };
20
21 using handle_type = std::coroutine_handle<promise_type>;
22 my_resumable(handle_type h) : m_handle(h) {}
23 ~my_resumable() { if (m_handle) m_handle.destroy(); }
24 my_resumable(my_resumable&& other) = delete;
25 handle_type m_handle;
26};
27
28struct ClassWithCoro {
29 int y{6};

Callers 1

get_return_objectMethod · 0.70

Calls

no outgoing calls

Tested by 1

get_return_objectMethod · 0.56