5 // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_IMPL_COMPOSE_HPP
12 #define BOOST_ASIO_IMPL_COMPOSE_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/associated_executor.hpp>
20 #include <boost/asio/detail/base_from_cancellation_state.hpp>
21 #include <boost/asio/detail/handler_alloc_helpers.hpp>
22 #include <boost/asio/detail/handler_cont_helpers.hpp>
23 #include <boost/asio/detail/handler_invoke_helpers.hpp>
24 #include <boost/asio/detail/type_traits.hpp>
25 #include <boost/asio/detail/variadic_templates.hpp>
26 #include <boost/asio/execution/executor.hpp>
27 #include <boost/asio/execution/outstanding_work.hpp>
28 #include <boost/asio/executor_work_guard.hpp>
29 #include <boost/asio/is_executor.hpp>
30 #include <boost/asio/system_executor.hpp>
32 #include <boost/asio/detail/push_options.hpp>
39 template <typename Executor, typename = void>
40 class composed_work_guard
43 typedef typename decay<
44 typename prefer_result<Executor,
45 execution::outstanding_work_t::tracked_t
47 >::type executor_type;
49 composed_work_guard(const Executor& ex)
50 : executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked))
58 executor_type get_executor() const BOOST_ASIO_NOEXCEPT
64 executor_type executor_;
68 struct composed_work_guard<system_executor>
71 typedef system_executor executor_type;
73 composed_work_guard(const system_executor&)
81 executor_type get_executor() const BOOST_ASIO_NOEXCEPT
83 return system_executor();
87 #if !defined(BOOST_ASIO_NO_TS_EXECUTORS)
89 template <typename Executor>
90 struct composed_work_guard<Executor,
92 !execution::is_executor<Executor>::value
93 >::type> : executor_work_guard<Executor>
95 composed_work_guard(const Executor& ex)
96 : executor_work_guard<Executor>(ex)
101 #endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS)
104 struct composed_io_executors;
107 struct composed_io_executors<void()>
109 composed_io_executors() BOOST_ASIO_NOEXCEPT
110 : head_(system_executor())
114 typedef system_executor head_type;
115 system_executor head_;
118 inline composed_io_executors<void()> make_composed_io_executors()
120 return composed_io_executors<void()>();
123 template <typename Head>
124 struct composed_io_executors<void(Head)>
126 explicit composed_io_executors(const Head& ex) BOOST_ASIO_NOEXCEPT
131 typedef Head head_type;
135 template <typename Head>
136 inline composed_io_executors<void(Head)>
137 make_composed_io_executors(const Head& head)
139 return composed_io_executors<void(Head)>(head);
142 #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
144 template <typename Head, typename... Tail>
145 struct composed_io_executors<void(Head, Tail...)>
147 explicit composed_io_executors(const Head& head,
148 const Tail&... tail) BOOST_ASIO_NOEXCEPT
160 typedef Head head_type;
162 composed_io_executors<void(Tail...)> tail_;
165 template <typename Head, typename... Tail>
166 inline composed_io_executors<void(Head, Tail...)>
167 make_composed_io_executors(const Head& head, const Tail&... tail)
169 return composed_io_executors<void(Head, Tail...)>(head, tail...);
172 #else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
174 #define BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF(n) \
175 template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
176 struct composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
178 explicit composed_io_executors(const Head& head, \
179 BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) BOOST_ASIO_NOEXCEPT \
181 tail_(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) \
191 typedef Head head_type; \
193 composed_io_executors<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \
196 template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
197 inline composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
198 make_composed_io_executors(const Head& head, \
199 BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) \
201 return composed_io_executors< \
202 void(Head, BOOST_ASIO_VARIADIC_TARGS(n))>( \
203 head, BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)); \
206 BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF)
207 #undef BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF
209 #endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
212 struct composed_work;
215 struct composed_work<void()>
217 typedef composed_io_executors<void()> executors_type;
219 composed_work(const executors_type&) BOOST_ASIO_NOEXCEPT
220 : head_(system_executor())
229 typedef system_executor head_type;
230 composed_work_guard<system_executor> head_;
233 template <typename Head>
234 struct composed_work<void(Head)>
236 typedef composed_io_executors<void(Head)> executors_type;
238 explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT
248 typedef Head head_type;
249 composed_work_guard<Head> head_;
252 #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
254 template <typename Head, typename... Tail>
255 struct composed_work<void(Head, Tail...)>
257 typedef composed_io_executors<void(Head, Tail...)> executors_type;
259 explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT
271 typedef Head head_type;
272 composed_work_guard<Head> head_;
273 composed_work<void(Tail...)> tail_;
276 #else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
278 #define BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF(n) \
279 template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
280 struct composed_work<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
282 typedef composed_io_executors<void(Head, \
283 BOOST_ASIO_VARIADIC_TARGS(n))> executors_type; \
285 explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT \
297 typedef Head head_type; \
298 composed_work_guard<Head> head_; \
299 composed_work<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \
302 BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF)
303 #undef BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF
305 #endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
307 #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
308 template <typename Impl, typename Work, typename Handler, typename Signature>
311 template <typename Impl, typename Work, typename Handler,
312 typename R, typename... Args>
313 class composed_op<Impl, Work, Handler, R(Args...)>
314 #else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
315 template <typename Impl, typename Work, typename Handler, typename Signature>
317 #endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
318 : public base_from_cancellation_state<Handler>
321 template <typename I, typename W, typename H>
322 composed_op(BOOST_ASIO_MOVE_ARG(I) impl,
323 BOOST_ASIO_MOVE_ARG(W) work,
324 BOOST_ASIO_MOVE_ARG(H) handler)
325 : base_from_cancellation_state<Handler>(
326 handler, enable_terminal_cancellation()),
327 impl_(BOOST_ASIO_MOVE_CAST(I)(impl)),
328 work_(BOOST_ASIO_MOVE_CAST(W)(work)),
329 handler_(BOOST_ASIO_MOVE_CAST(H)(handler)),
334 #if defined(BOOST_ASIO_HAS_MOVE)
335 composed_op(composed_op&& other)
336 : base_from_cancellation_state<Handler>(
337 BOOST_ASIO_MOVE_CAST(base_from_cancellation_state<
339 impl_(BOOST_ASIO_MOVE_CAST(Impl)(other.impl_)),
340 work_(BOOST_ASIO_MOVE_CAST(Work)(other.work_)),
341 handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)),
342 invocations_(other.invocations_)
345 #endif // defined(BOOST_ASIO_HAS_MOVE)
347 typedef typename associated_executor<Handler,
348 typename composed_work_guard<
349 typename Work::head_type
351 >::type executor_type;
353 executor_type get_executor() const BOOST_ASIO_NOEXCEPT
355 return (get_associated_executor)(handler_, work_.head_.get_executor());
358 typedef typename associated_allocator<Handler,
359 std::allocator<void> >::type allocator_type;
361 allocator_type get_allocator() const BOOST_ASIO_NOEXCEPT
363 return (get_associated_allocator)(handler_, std::allocator<void>());
366 #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
368 template<typename... T>
369 void operator()(BOOST_ASIO_MOVE_ARG(T)... t)
371 if (invocations_ < ~0u)
373 this->get_cancellation_state().slot().clear();
374 impl_(*this, BOOST_ASIO_MOVE_CAST(T)(t)...);
377 void complete(Args... args)
380 BOOST_ASIO_MOVE_OR_LVALUE(Handler)(this->handler_)(
381 BOOST_ASIO_MOVE_CAST(Args)(args)...);
384 #else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
388 if (invocations_ < ~0u)
390 this->get_cancellation_state().slot().clear();
397 BOOST_ASIO_MOVE_OR_LVALUE(Handler)(this->handler_)();
400 #define BOOST_ASIO_PRIVATE_COMPOSED_OP_DEF(n) \
401 template<BOOST_ASIO_VARIADIC_TPARAMS(n)> \
402 void operator()(BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
404 if (invocations_ < ~0u) \
406 this->get_cancellation_state().slot().clear(); \
407 impl_(*this, BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
410 template<BOOST_ASIO_VARIADIC_TPARAMS(n)> \
411 void complete(BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
413 this->work_.reset(); \
414 BOOST_ASIO_MOVE_OR_LVALUE(Handler)(this->handler_)( \
415 BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
418 BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_OP_DEF)
419 #undef BOOST_ASIO_PRIVATE_COMPOSED_OP_DEF
421 #endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
423 void reset_cancellation_state()
425 base_from_cancellation_state<Handler>::reset_cancellation_state(handler_);
428 template <typename Filter>
429 void reset_cancellation_state(BOOST_ASIO_MOVE_ARG(Filter) filter)
431 base_from_cancellation_state<Handler>::reset_cancellation_state(handler_,
432 BOOST_ASIO_MOVE_CAST(Filter)(filter));
435 template <typename InFilter, typename OutFilter>
436 void reset_cancellation_state(BOOST_ASIO_MOVE_ARG(InFilter) in_filter,
437 BOOST_ASIO_MOVE_ARG(OutFilter) out_filter)
439 base_from_cancellation_state<Handler>::reset_cancellation_state(handler_,
440 BOOST_ASIO_MOVE_CAST(InFilter)(in_filter),
441 BOOST_ASIO_MOVE_CAST(OutFilter)(out_filter));
448 unsigned invocations_;
451 template <typename Impl, typename Work, typename Handler, typename Signature>
452 inline asio_handler_allocate_is_deprecated
453 asio_handler_allocate(std::size_t size,
454 composed_op<Impl, Work, Handler, Signature>* this_handler)
456 #if defined(BOOST_ASIO_NO_DEPRECATED)
457 boost_asio_handler_alloc_helpers::allocate(size, this_handler->handler_);
458 return asio_handler_allocate_is_no_longer_used();
459 #else // defined(BOOST_ASIO_NO_DEPRECATED)
460 return boost_asio_handler_alloc_helpers::allocate(
461 size, this_handler->handler_);
462 #endif // defined(BOOST_ASIO_NO_DEPRECATED)
465 template <typename Impl, typename Work, typename Handler, typename Signature>
466 inline asio_handler_deallocate_is_deprecated
467 asio_handler_deallocate(void* pointer, std::size_t size,
468 composed_op<Impl, Work, Handler, Signature>* this_handler)
470 boost_asio_handler_alloc_helpers::deallocate(
471 pointer, size, this_handler->handler_);
472 #if defined(BOOST_ASIO_NO_DEPRECATED)
473 return asio_handler_deallocate_is_no_longer_used();
474 #endif // defined(BOOST_ASIO_NO_DEPRECATED)
477 template <typename Impl, typename Work, typename Handler, typename Signature>
478 inline bool asio_handler_is_continuation(
479 composed_op<Impl, Work, Handler, Signature>* this_handler)
481 return this_handler->invocations_ > 1 ? true
482 : boost_asio_handler_cont_helpers::is_continuation(
483 this_handler->handler_);
486 template <typename Function, typename Impl,
487 typename Work, typename Handler, typename Signature>
488 inline asio_handler_invoke_is_deprecated
489 asio_handler_invoke(Function& function,
490 composed_op<Impl, Work, Handler, Signature>* this_handler)
492 boost_asio_handler_invoke_helpers::invoke(
493 function, this_handler->handler_);
494 #if defined(BOOST_ASIO_NO_DEPRECATED)
495 return asio_handler_invoke_is_no_longer_used();
496 #endif // defined(BOOST_ASIO_NO_DEPRECATED)
499 template <typename Function, typename Impl,
500 typename Work, typename Handler, typename Signature>
501 inline asio_handler_invoke_is_deprecated
502 asio_handler_invoke(const Function& function,
503 composed_op<Impl, Work, Handler, Signature>* this_handler)
505 boost_asio_handler_invoke_helpers::invoke(
506 function, this_handler->handler_);
507 #if defined(BOOST_ASIO_NO_DEPRECATED)
508 return asio_handler_invoke_is_no_longer_used();
509 #endif // defined(BOOST_ASIO_NO_DEPRECATED)
512 template <typename Signature, typename Executors>
513 class initiate_composed_op
516 typedef typename composed_io_executors<Executors>::head_type executor_type;
518 template <typename T>
519 explicit initiate_composed_op(int, BOOST_ASIO_MOVE_ARG(T) executors)
520 : executors_(BOOST_ASIO_MOVE_CAST(T)(executors))
524 executor_type get_executor() const BOOST_ASIO_NOEXCEPT
526 return executors_.head_;
529 template <typename Handler, typename Impl>
530 void operator()(BOOST_ASIO_MOVE_ARG(Handler) handler,
531 BOOST_ASIO_MOVE_ARG(Impl) impl) const
533 composed_op<typename decay<Impl>::type, composed_work<Executors>,
534 typename decay<Handler>::type, Signature>(
535 BOOST_ASIO_MOVE_CAST(Impl)(impl),
536 composed_work<Executors>(executors_),
537 BOOST_ASIO_MOVE_CAST(Handler)(handler))();
541 composed_io_executors<Executors> executors_;
544 template <typename Signature, typename Executors>
545 inline initiate_composed_op<Signature, Executors> make_initiate_composed_op(
546 BOOST_ASIO_MOVE_ARG(composed_io_executors<Executors>) executors)
548 return initiate_composed_op<Signature, Executors>(0,
549 BOOST_ASIO_MOVE_CAST(composed_io_executors<Executors>)(executors));
552 template <typename IoObject>
553 inline typename IoObject::executor_type
554 get_composed_io_executor(IoObject& io_object,
556 !is_executor<IoObject>::value
559 !execution::is_executor<IoObject>::value
562 return io_object.get_executor();
565 template <typename Executor>
566 inline const Executor& get_composed_io_executor(const Executor& ex,
568 is_executor<Executor>::value
569 || execution::is_executor<Executor>::value
574 } // namespace detail
576 #if !defined(GENERATING_DOCUMENTATION)
578 template <template <typename, typename> class Associator,
579 typename Impl, typename Work, typename Handler,
580 typename Signature, typename DefaultCandidate>
581 struct associator<Associator,
582 detail::composed_op<Impl, Work, Handler, Signature>,
584 : Associator<Handler, DefaultCandidate>
586 static typename Associator<Handler, DefaultCandidate>::type get(
587 const detail::composed_op<Impl, Work, Handler, Signature>& h,
588 const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
590 return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
594 #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
596 template <typename CompletionToken, typename Signature,
597 typename Implementation, typename... IoObjectsOrExecutors>
598 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature)
599 async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation,
600 BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token,
601 BOOST_ASIO_MOVE_ARG(IoObjectsOrExecutors)... io_objects_or_executors)
603 return async_initiate<CompletionToken, Signature>(
604 detail::make_initiate_composed_op<Signature>(
605 detail::make_composed_io_executors(
606 detail::get_composed_io_executor(
607 BOOST_ASIO_MOVE_CAST(IoObjectsOrExecutors)(
608 io_objects_or_executors))...)),
609 token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation));
612 #else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
614 template <typename CompletionToken, typename Signature, typename Implementation>
615 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature)
616 async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation,
617 BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token)
619 return async_initiate<CompletionToken, Signature>(
620 detail::make_initiate_composed_op<Signature>(
621 detail::make_composed_io_executors()),
622 token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation));
625 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n) \
626 BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_##n
628 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_1 \
629 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1))
630 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_2 \
631 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \
632 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2))
633 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_3 \
634 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \
635 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \
636 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3))
637 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_4 \
638 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \
639 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \
640 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \
641 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4))
642 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_5 \
643 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \
644 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \
645 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \
646 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)), \
647 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T5)(x5))
648 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_6 \
649 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \
650 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \
651 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \
652 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)), \
653 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T5)(x5)), \
654 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T6)(x6))
655 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_7 \
656 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \
657 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \
658 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \
659 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)), \
660 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T5)(x5)), \
661 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T6)(x6)), \
662 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T7)(x7))
663 # define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_8 \
664 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \
665 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \
666 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \
667 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)), \
668 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T5)(x5)), \
669 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T6)(x6)), \
670 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T7)(x7)), \
671 detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T8)(x8))
673 #define BOOST_ASIO_PRIVATE_ASYNC_COMPOSE_DEF(n) \
674 template <typename CompletionToken, typename Signature, \
675 typename Implementation, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
676 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature) \
677 async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation, \
678 BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \
679 BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
681 return async_initiate<CompletionToken, Signature>( \
682 detail::make_initiate_composed_op<Signature>( \
683 detail::make_composed_io_executors( \
684 BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n))), \
685 token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation)); \
688 BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_ASYNC_COMPOSE_DEF)
689 #undef BOOST_ASIO_PRIVATE_ASYNC_COMPOSE_DEF
691 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR
692 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_1
693 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_2
694 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_3
695 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_4
696 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_5
697 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_6
698 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_7
699 #undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_8
701 #endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
702 #endif // !defined(GENERATING_DOCUMENTATION)
707 #include <boost/asio/detail/pop_options.hpp>
709 #endif // BOOST_ASIO_IMPL_COMPOSE_HPP