MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / operator co_await

Function operator co_await

tests/EduCoroutineCoAwaitOperatorTest.cpp:32–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31template<class Rep, class Period>
32auto operator co_await(std::chrono::duration<Rep, Period> d)
33{
34 struct awaiter
35 {
36 std::chrono::system_clock::duration duration;
37 awaiter(std::chrono::system_clock::duration d)
38 : duration(d)
39 {}
40
41 bool await_ready() const { return duration.count() <= 0; }
42 void await_resume() {}
43 void await_suspend(std::coroutine_handle<> h) { }
44 };
45
46 return awaiter{d};
47}
48using namespace std::chrono;
49
50my_future<int> h();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected