From 0f222bf566136903db7d37017c3bc020229f9dc0 Mon Sep 17 00:00:00 2001 From: xlauko Date: Tue, 27 Feb 2024 11:02:35 +0100 Subject: [PATCH] coro: add make_task --- coro/include/gap/coro/task.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/coro/include/gap/coro/task.hpp b/coro/include/gap/coro/task.hpp index 2c071e1..be39174 100644 --- a/coro/include/gap/coro/task.hpp +++ b/coro/include/gap/coro/task.hpp @@ -252,6 +252,13 @@ namespace gap::coro coroutine_handle m_coroutine = nullptr; }; + template< awaitable awaitable_t > + auto make_task(awaitable_t awaitable) + -> task< std::remove_reference_t< await_result_t< awaitable_t > > > + { + co_return co_await static_cast< awaitable_t&& >(awaitable); + } + namespace detail { template< typename T >