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_BIND_EXECUTOR_HPP
12 #define BOOST_ASIO_BIND_EXECUTOR_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/detail/type_traits.hpp>
20 #include <boost/asio/detail/variadic_templates.hpp>
21 #include <boost/asio/associated_executor.hpp>
22 #include <boost/asio/associator.hpp>
23 #include <boost/asio/async_result.hpp>
24 #include <boost/asio/execution/executor.hpp>
25 #include <boost/asio/execution_context.hpp>
26 #include <boost/asio/is_executor.hpp>
27 #include <boost/asio/uses_executor.hpp>
29 #include <boost/asio/detail/push_options.hpp>
35 // Helper to automatically define nested typedef result_type.
37 template <typename T, typename = void>
38 struct executor_binder_result_type
41 typedef void result_type_or_void;
45 struct executor_binder_result_type<T,
46 typename void_type<typename T::result_type>::type>
48 typedef typename T::result_type result_type;
50 typedef result_type result_type_or_void;
54 struct executor_binder_result_type<R(*)()>
56 typedef R result_type;
58 typedef result_type result_type_or_void;
62 struct executor_binder_result_type<R(&)()>
64 typedef R result_type;
66 typedef result_type result_type_or_void;
69 template <typename R, typename A1>
70 struct executor_binder_result_type<R(*)(A1)>
72 typedef R result_type;
74 typedef result_type result_type_or_void;
77 template <typename R, typename A1>
78 struct executor_binder_result_type<R(&)(A1)>
80 typedef R result_type;
82 typedef result_type result_type_or_void;
85 template <typename R, typename A1, typename A2>
86 struct executor_binder_result_type<R(*)(A1, A2)>
88 typedef R result_type;
90 typedef result_type result_type_or_void;
93 template <typename R, typename A1, typename A2>
94 struct executor_binder_result_type<R(&)(A1, A2)>
96 typedef R result_type;
98 typedef result_type result_type_or_void;
101 // Helper to automatically define nested typedef argument_type.
103 template <typename T, typename = void>
104 struct executor_binder_argument_type {};
106 template <typename T>
107 struct executor_binder_argument_type<T,
108 typename void_type<typename T::argument_type>::type>
110 typedef typename T::argument_type argument_type;
113 template <typename R, typename A1>
114 struct executor_binder_argument_type<R(*)(A1)>
116 typedef A1 argument_type;
119 template <typename R, typename A1>
120 struct executor_binder_argument_type<R(&)(A1)>
122 typedef A1 argument_type;
125 // Helper to automatically define nested typedefs first_argument_type and
126 // second_argument_type.
128 template <typename T, typename = void>
129 struct executor_binder_argument_types {};
131 template <typename T>
132 struct executor_binder_argument_types<T,
133 typename void_type<typename T::first_argument_type>::type>
135 typedef typename T::first_argument_type first_argument_type;
136 typedef typename T::second_argument_type second_argument_type;
139 template <typename R, typename A1, typename A2>
140 struct executor_binder_argument_type<R(*)(A1, A2)>
142 typedef A1 first_argument_type;
143 typedef A2 second_argument_type;
146 template <typename R, typename A1, typename A2>
147 struct executor_binder_argument_type<R(&)(A1, A2)>
149 typedef A1 first_argument_type;
150 typedef A2 second_argument_type;
153 // Helper to perform uses_executor construction of the target type, if
156 template <typename T, typename Executor, bool UsesExecutor>
157 class executor_binder_base;
159 template <typename T, typename Executor>
160 class executor_binder_base<T, Executor, true>
163 template <typename E, typename U>
164 executor_binder_base(BOOST_ASIO_MOVE_ARG(E) e, BOOST_ASIO_MOVE_ARG(U) u)
165 : executor_(BOOST_ASIO_MOVE_CAST(E)(e)),
166 target_(executor_arg_t(), executor_, BOOST_ASIO_MOVE_CAST(U)(u))
174 template <typename T, typename Executor>
175 class executor_binder_base<T, Executor, false>
178 template <typename E, typename U>
179 executor_binder_base(BOOST_ASIO_MOVE_ARG(E) e, BOOST_ASIO_MOVE_ARG(U) u)
180 : executor_(BOOST_ASIO_MOVE_CAST(E)(e)),
181 target_(BOOST_ASIO_MOVE_CAST(U)(u))
189 // Helper to enable SFINAE on zero-argument operator() below.
191 template <typename T, typename = void>
192 struct executor_binder_result_of0
197 template <typename T>
198 struct executor_binder_result_of0<T,
199 typename void_type<typename result_of<T()>::type>::type>
201 typedef typename result_of<T()>::type type;
204 } // namespace detail
206 /// A call wrapper type to bind an executor of type @c Executor to an object of
208 template <typename T, typename Executor>
209 class executor_binder
210 #if !defined(GENERATING_DOCUMENTATION)
211 : public detail::executor_binder_result_type<T>,
212 public detail::executor_binder_argument_type<T>,
213 public detail::executor_binder_argument_types<T>,
214 private detail::executor_binder_base<
215 T, Executor, uses_executor<T, Executor>::value>
216 #endif // !defined(GENERATING_DOCUMENTATION)
219 /// The type of the target object.
220 typedef T target_type;
222 /// The type of the associated executor.
223 typedef Executor executor_type;
225 #if defined(GENERATING_DOCUMENTATION)
226 /// The return type if a function.
228 * The type of @c result_type is based on the type @c T of the wrapper's
231 * @li if @c T is a pointer to function type, @c result_type is a synonym for
232 * the return type of @c T;
234 * @li if @c T is a class type with a member type @c result_type, then @c
235 * result_type is a synonym for @c T::result_type;
237 * @li otherwise @c result_type is not defined.
239 typedef see_below result_type;
241 /// The type of the function's argument.
243 * The type of @c argument_type is based on the type @c T of the wrapper's
246 * @li if @c T is a pointer to a function type accepting a single argument,
247 * @c argument_type is a synonym for the return type of @c T;
249 * @li if @c T is a class type with a member type @c argument_type, then @c
250 * argument_type is a synonym for @c T::argument_type;
252 * @li otherwise @c argument_type is not defined.
254 typedef see_below argument_type;
256 /// The type of the function's first argument.
258 * The type of @c first_argument_type is based on the type @c T of the
259 * wrapper's target object:
261 * @li if @c T is a pointer to a function type accepting two arguments, @c
262 * first_argument_type is a synonym for the return type of @c T;
264 * @li if @c T is a class type with a member type @c first_argument_type,
265 * then @c first_argument_type is a synonym for @c T::first_argument_type;
267 * @li otherwise @c first_argument_type is not defined.
269 typedef see_below first_argument_type;
271 /// The type of the function's second argument.
273 * The type of @c second_argument_type is based on the type @c T of the
274 * wrapper's target object:
276 * @li if @c T is a pointer to a function type accepting two arguments, @c
277 * second_argument_type is a synonym for the return type of @c T;
279 * @li if @c T is a class type with a member type @c first_argument_type,
280 * then @c second_argument_type is a synonym for @c T::second_argument_type;
282 * @li otherwise @c second_argument_type is not defined.
284 typedef see_below second_argument_type;
285 #endif // defined(GENERATING_DOCUMENTATION)
287 /// Construct an executor wrapper for the specified object.
289 * This constructor is only valid if the type @c T is constructible from type
292 template <typename U>
293 executor_binder(executor_arg_t, const executor_type& e,
294 BOOST_ASIO_MOVE_ARG(U) u)
295 : base_type(e, BOOST_ASIO_MOVE_CAST(U)(u))
299 /// Copy constructor.
300 executor_binder(const executor_binder& other)
301 : base_type(other.get_executor(), other.get())
305 /// Construct a copy, but specify a different executor.
306 executor_binder(executor_arg_t, const executor_type& e,
307 const executor_binder& other)
308 : base_type(e, other.get())
312 /// Construct a copy of a different executor wrapper type.
314 * This constructor is only valid if the @c Executor type is constructible
315 * from type @c OtherExecutor, and the type @c T is constructible from type
318 template <typename U, typename OtherExecutor>
319 executor_binder(const executor_binder<U, OtherExecutor>& other)
320 : base_type(other.get_executor(), other.get())
324 /// Construct a copy of a different executor wrapper type, but specify a
325 /// different executor.
327 * This constructor is only valid if the type @c T is constructible from type
330 template <typename U, typename OtherExecutor>
331 executor_binder(executor_arg_t, const executor_type& e,
332 const executor_binder<U, OtherExecutor>& other)
333 : base_type(e, other.get())
337 #if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
339 /// Move constructor.
340 executor_binder(executor_binder&& other)
341 : base_type(BOOST_ASIO_MOVE_CAST(executor_type)(other.get_executor()),
342 BOOST_ASIO_MOVE_CAST(T)(other.get()))
346 /// Move construct the target object, but specify a different executor.
347 executor_binder(executor_arg_t, const executor_type& e,
348 executor_binder&& other)
349 : base_type(e, BOOST_ASIO_MOVE_CAST(T)(other.get()))
353 /// Move construct from a different executor wrapper type.
354 template <typename U, typename OtherExecutor>
355 executor_binder(executor_binder<U, OtherExecutor>&& other)
356 : base_type(BOOST_ASIO_MOVE_CAST(OtherExecutor)(other.get_executor()),
357 BOOST_ASIO_MOVE_CAST(U)(other.get()))
361 /// Move construct from a different executor wrapper type, but specify a
362 /// different executor.
363 template <typename U, typename OtherExecutor>
364 executor_binder(executor_arg_t, const executor_type& e,
365 executor_binder<U, OtherExecutor>&& other)
366 : base_type(e, BOOST_ASIO_MOVE_CAST(U)(other.get()))
370 #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
377 /// Obtain a reference to the target object.
378 target_type& get() BOOST_ASIO_NOEXCEPT
380 return this->target_;
383 /// Obtain a reference to the target object.
384 const target_type& get() const BOOST_ASIO_NOEXCEPT
386 return this->target_;
389 /// Obtain the associated executor.
390 executor_type get_executor() const BOOST_ASIO_NOEXCEPT
392 return this->executor_;
395 #if defined(GENERATING_DOCUMENTATION)
397 template <typename... Args> auto operator()(Args&& ...);
398 template <typename... Args> auto operator()(Args&& ...) const;
400 #elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
402 /// Forwarding function call operator.
403 template <typename... Args>
404 typename result_of<T(Args...)>::type operator()(
405 BOOST_ASIO_MOVE_ARG(Args)... args)
407 return this->target_(BOOST_ASIO_MOVE_CAST(Args)(args)...);
410 /// Forwarding function call operator.
411 template <typename... Args>
412 typename result_of<T(Args...)>::type operator()(
413 BOOST_ASIO_MOVE_ARG(Args)... args) const
415 return this->target_(BOOST_ASIO_MOVE_CAST(Args)(args)...);
418 #elif defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER)
420 typename detail::executor_binder_result_of0<T>::type operator()()
422 return this->target_();
425 typename detail::executor_binder_result_of0<T>::type operator()() const
427 return this->target_();
430 #define BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF(n) \
431 template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
432 typename result_of<T(BOOST_ASIO_VARIADIC_TARGS(n))>::type operator()( \
433 BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
435 return this->target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
438 template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
439 typename result_of<T(BOOST_ASIO_VARIADIC_TARGS(n))>::type operator()( \
440 BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \
442 return this->target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
445 BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF)
446 #undef BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF
448 #else // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER)
450 typedef typename detail::executor_binder_result_type<T>::result_type_or_void
453 result_type_or_void operator()()
455 return this->target_();
458 result_type_or_void operator()() const
460 return this->target_();
463 #define BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF(n) \
464 template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
465 result_type_or_void operator()( \
466 BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
468 return this->target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
471 template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
472 result_type_or_void operator()( \
473 BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \
475 return this->target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
478 BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF)
479 #undef BOOST_ASIO_PRIVATE_BIND_EXECUTOR_CALL_DEF
481 #endif // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER)
484 typedef detail::executor_binder_base<T, Executor,
485 uses_executor<T, Executor>::value> base_type;
488 /// Associate an object of type @c T with an executor of type @c Executor.
489 template <typename Executor, typename T>
490 BOOST_ASIO_NODISCARD inline executor_binder<typename decay<T>::type, Executor>
491 bind_executor(const Executor& ex, BOOST_ASIO_MOVE_ARG(T) t,
493 is_executor<Executor>::value || execution::is_executor<Executor>::value
496 return executor_binder<typename decay<T>::type, Executor>(
497 executor_arg_t(), ex, BOOST_ASIO_MOVE_CAST(T)(t));
500 /// Associate an object of type @c T with an execution context's executor.
501 template <typename ExecutionContext, typename T>
502 BOOST_ASIO_NODISCARD inline executor_binder<typename decay<T>::type,
503 typename ExecutionContext::executor_type>
504 bind_executor(ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(T) t,
505 typename constraint<is_convertible<
506 ExecutionContext&, execution_context&>::value>::type = 0)
508 return executor_binder<typename decay<T>::type,
509 typename ExecutionContext::executor_type>(
510 executor_arg_t(), ctx.get_executor(), BOOST_ASIO_MOVE_CAST(T)(t));
513 #if !defined(GENERATING_DOCUMENTATION)
515 template <typename T, typename Executor>
516 struct uses_executor<executor_binder<T, Executor>, Executor>
521 template <typename TargetAsyncResult, typename Executor, typename = void>
522 class executor_binder_completion_handler_async_result
525 template <typename T>
526 explicit executor_binder_completion_handler_async_result(T&)
531 template <typename TargetAsyncResult, typename Executor>
532 class executor_binder_completion_handler_async_result<
533 TargetAsyncResult, Executor,
535 typename TargetAsyncResult::completion_handler_type
539 typedef executor_binder<
540 typename TargetAsyncResult::completion_handler_type, Executor>
541 completion_handler_type;
543 explicit executor_binder_completion_handler_async_result(
544 typename TargetAsyncResult::completion_handler_type& handler)
549 typename TargetAsyncResult::return_type get()
551 return target_.get();
555 TargetAsyncResult target_;
558 template <typename TargetAsyncResult, typename = void>
559 struct executor_binder_async_result_return_type
563 template <typename TargetAsyncResult>
564 struct executor_binder_async_result_return_type<
567 typename TargetAsyncResult::return_type
570 typedef typename TargetAsyncResult::return_type return_type;
573 } // namespace detail
575 template <typename T, typename Executor, typename Signature>
576 class async_result<executor_binder<T, Executor>, Signature> :
577 public detail::executor_binder_completion_handler_async_result<
578 async_result<T, Signature>, Executor>,
579 public detail::executor_binder_async_result_return_type<
580 async_result<T, Signature> >
583 explicit async_result(executor_binder<T, Executor>& b)
584 : detail::executor_binder_completion_handler_async_result<
585 async_result<T, Signature>, Executor>(b.get())
589 template <typename Initiation>
592 template <typename Init>
593 init_wrapper(const Executor& ex, BOOST_ASIO_MOVE_ARG(Init) init)
595 initiation_(BOOST_ASIO_MOVE_CAST(Init)(init))
599 #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
601 template <typename Handler, typename... Args>
603 BOOST_ASIO_MOVE_ARG(Handler) handler,
604 BOOST_ASIO_MOVE_ARG(Args)... args)
606 BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)(
607 executor_binder<typename decay<Handler>::type, Executor>(
608 executor_arg_t(), ex_, BOOST_ASIO_MOVE_CAST(Handler)(handler)),
609 BOOST_ASIO_MOVE_CAST(Args)(args)...);
612 template <typename Handler, typename... Args>
614 BOOST_ASIO_MOVE_ARG(Handler) handler,
615 BOOST_ASIO_MOVE_ARG(Args)... args) const
618 executor_binder<typename decay<Handler>::type, Executor>(
619 executor_arg_t(), ex_, BOOST_ASIO_MOVE_CAST(Handler)(handler)),
620 BOOST_ASIO_MOVE_CAST(Args)(args)...);
623 #else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
625 template <typename Handler>
627 BOOST_ASIO_MOVE_ARG(Handler) handler)
629 BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)(
630 executor_binder<typename decay<Handler>::type, Executor>(
631 executor_arg_t(), ex_, BOOST_ASIO_MOVE_CAST(Handler)(handler)));
634 template <typename Handler>
636 BOOST_ASIO_MOVE_ARG(Handler) handler) const
639 executor_binder<typename decay<Handler>::type, Executor>(
640 executor_arg_t(), ex_, BOOST_ASIO_MOVE_CAST(Handler)(handler)));
643 #define BOOST_ASIO_PRIVATE_INIT_WRAPPER_DEF(n) \
644 template <typename Handler, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
646 BOOST_ASIO_MOVE_ARG(Handler) handler, \
647 BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
649 BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)( \
650 executor_binder<typename decay<Handler>::type, Executor>( \
651 executor_arg_t(), ex_, BOOST_ASIO_MOVE_CAST(Handler)(handler)), \
652 BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
655 template <typename Handler, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
657 BOOST_ASIO_MOVE_ARG(Handler) handler, \
658 BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \
661 executor_binder<typename decay<Handler>::type, Executor>( \
662 executor_arg_t(), ex_, BOOST_ASIO_MOVE_CAST(Handler)(handler)), \
663 BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
666 BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_INIT_WRAPPER_DEF)
667 #undef BOOST_ASIO_PRIVATE_INIT_WRAPPER_DEF
669 #endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
672 Initiation initiation_;
675 #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
677 template <typename Initiation, typename RawCompletionToken, typename... Args>
678 static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature,
679 (async_initiate<T, Signature>(
680 declval<init_wrapper<typename decay<Initiation>::type> >(),
681 declval<RawCompletionToken>().get(),
682 declval<BOOST_ASIO_MOVE_ARG(Args)>()...)))
684 BOOST_ASIO_MOVE_ARG(Initiation) initiation,
685 BOOST_ASIO_MOVE_ARG(RawCompletionToken) token,
686 BOOST_ASIO_MOVE_ARG(Args)... args)
688 return async_initiate<T, Signature>(
689 init_wrapper<typename decay<Initiation>::type>(
690 token.get_executor(), BOOST_ASIO_MOVE_CAST(Initiation)(initiation)),
691 token.get(), BOOST_ASIO_MOVE_CAST(Args)(args)...);
694 #else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
696 template <typename Initiation, typename RawCompletionToken>
697 static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature,
698 (async_initiate<T, Signature>(
699 declval<init_wrapper<typename decay<Initiation>::type> >(),
700 declval<RawCompletionToken>().get())))
702 BOOST_ASIO_MOVE_ARG(Initiation) initiation,
703 BOOST_ASIO_MOVE_ARG(RawCompletionToken) token)
705 return async_initiate<T, Signature>(
706 init_wrapper<typename decay<Initiation>::type>(
707 token.get_executor(), BOOST_ASIO_MOVE_CAST(Initiation)(initiation)),
711 #define BOOST_ASIO_PRIVATE_INITIATE_DEF(n) \
712 template <typename Initiation, typename RawCompletionToken, \
713 BOOST_ASIO_VARIADIC_TPARAMS(n)> \
714 static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature, \
715 (async_initiate<T, Signature>( \
716 declval<init_wrapper<typename decay<Initiation>::type> >(), \
717 declval<RawCompletionToken>().get(), \
718 BOOST_ASIO_VARIADIC_MOVE_DECLVAL(n)))) \
720 BOOST_ASIO_MOVE_ARG(Initiation) initiation, \
721 BOOST_ASIO_MOVE_ARG(RawCompletionToken) token, \
722 BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
724 return async_initiate<T, Signature>( \
725 init_wrapper<typename decay<Initiation>::type>( \
726 token.get_executor(), BOOST_ASIO_MOVE_CAST(Initiation)(initiation)), \
727 token.get(), BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
730 BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_INITIATE_DEF)
731 #undef BOOST_ASIO_PRIVATE_INITIATE_DEF
733 #endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
736 async_result(const async_result&) BOOST_ASIO_DELETED;
737 async_result& operator=(const async_result&) BOOST_ASIO_DELETED;
740 template <template <typename, typename> class Associator,
741 typename T, typename Executor, typename DefaultCandidate>
742 struct associator<Associator, executor_binder<T, Executor>, DefaultCandidate>
744 typedef typename Associator<T, DefaultCandidate>::type type;
746 static type get(const executor_binder<T, Executor>& b,
747 const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
749 return Associator<T, DefaultCandidate>::get(b.get(), c);
753 template <typename T, typename Executor, typename Executor1>
754 struct associated_executor<executor_binder<T, Executor>, Executor1>
756 typedef Executor type;
758 static type get(const executor_binder<T, Executor>& b,
759 const Executor1& = Executor1()) BOOST_ASIO_NOEXCEPT
761 return b.get_executor();
765 #endif // !defined(GENERATING_DOCUMENTATION)
770 #include <boost/asio/detail/pop_options.hpp>
772 #endif // BOOST_ASIO_BIND_EXECUTOR_HPP