27 template<std::invocable<> Fn>
31 static constexpr
bool is_async =
false;
44 template<std::invocable<> Fn>
45 requires coro::directly_awaitable<std::invoke_result_t<Fn> >
49 static constexpr
bool is_async =
true;
52 make_awaitable(Fn &fn) :_awaiter(fn()) {}
54 bool await_ready() {
return _awaiter.await_ready();}
55 auto await_suspend(std::coroutine_handle<> h) {
return _awaiter.await_suspend(h);}
56 decltype(
auto) await_resume() {
return _awaiter.await_resume();}
59 std::invoke_result_t<Fn> _awaiter;
62 template<std::invocable<> Fn>
63 requires coro::indirectly_awaitable<std::invoke_result_t<Fn> >
64 class make_awaitable<Fn> {
67 static constexpr
bool is_async =
true;
69 make_awaitable(Fn &&fn):_awaitable(fn()),_awaiter(_awaitable.operator co_await()) {}
70 make_awaitable(Fn &fn) :_awaitable(fn()),_awaiter(_awaitable.operator co_await()) {}
72 bool await_ready() {
return _awaiter.await_ready();}
73 auto await_suspend(std::coroutine_handle<> h) {
return _awaiter.await_suspend(h);}
74 decltype(
auto) await_resume() {
return _awaiter.await_resume();}
77 std::invoke_result_t<Fn> _awaitable;
78 decltype(std::declval<std::invoke_result_t<Fn> >().
operator co_await()) _awaiter;
81 template<typename T, typename RetVal>
82 concept maybe_awaitable = awaitable_r<make_awaitable<
coro::function<T()> >, RetVal>;
Converts any result to awaitable object.