Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / asio / co_spawn.hpp
index 67d17e2..bb55c55 100644 (file)
@@ -54,10 +54,15 @@ struct awaitable_signature<awaitable<void, Executor>>
  *
  * where @c E is convertible from @c Executor.
  */
-template <typename Executor, typename F, typename CompletionToken>
-BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken,
+template <typename Executor, typename F,
+    BOOST_ASIO_COMPLETION_TOKEN_FOR(typename detail::awaitable_signature<
+      typename result_of<F()>::type>::type) CompletionToken
+        BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
+BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken,
     typename detail::awaitable_signature<typename result_of<F()>::type>::type)
-co_spawn(const Executor& ex, F&& f, CompletionToken&& token,
+co_spawn(const Executor& ex, F&& f,
+    CompletionToken&& token
+      BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
     typename enable_if<
       is_executor<Executor>::value
     >::type* = 0);
@@ -70,10 +75,17 @@ co_spawn(const Executor& ex, F&& f, CompletionToken&& token,
  *
  * where @c E is convertible from @c ExecutionContext::executor_type.
  */
-template <typename ExecutionContext, typename F, typename CompletionToken>
-BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken,
+template <typename ExecutionContext, typename F,
+    BOOST_ASIO_COMPLETION_TOKEN_FOR(typename detail::awaitable_signature<
+      typename result_of<F()>::type>::type) CompletionToken
+        BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
+          typename ExecutionContext::executor_type)>
+BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken,
     typename detail::awaitable_signature<typename result_of<F()>::type>::type)
-co_spawn(ExecutionContext& ctx, F&& f, CompletionToken&& token,
+co_spawn(ExecutionContext& ctx, F&& f,
+    CompletionToken&& token
+      BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
+        typename ExecutionContext::executor_type),
     typename enable_if<
       is_convertible<ExecutionContext&, execution_context&>::value
     >::type* = 0);