2 // detail/bind_handler.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2019 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_DETAIL_BIND_HANDLER_HPP
12 #define BOOST_ASIO_DETAIL_BIND_HANDLER_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_allocator.hpp>
20 #include <boost/asio/associated_executor.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>
26 #include <boost/asio/detail/push_options.hpp>
32 template <typename Handler, typename Arg1>
37 binder1(int, BOOST_ASIO_MOVE_ARG(T) handler, const Arg1& arg1)
38 : handler_(BOOST_ASIO_MOVE_CAST(T)(handler)),
43 binder1(Handler& handler, const Arg1& arg1)
44 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
49 #if defined(BOOST_ASIO_HAS_MOVE)
50 binder1(const binder1& other)
51 : handler_(other.handler_),
56 binder1(binder1&& other)
57 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)),
58 arg1_(BOOST_ASIO_MOVE_CAST(Arg1)(other.arg1_))
61 #endif // defined(BOOST_ASIO_HAS_MOVE)
65 handler_(static_cast<const Arg1&>(arg1_));
68 void operator()() const
78 template <typename Handler, typename Arg1>
79 inline void* asio_handler_allocate(std::size_t size,
80 binder1<Handler, Arg1>* this_handler)
82 return boost_asio_handler_alloc_helpers::allocate(
83 size, this_handler->handler_);
86 template <typename Handler, typename Arg1>
87 inline void asio_handler_deallocate(void* pointer, std::size_t size,
88 binder1<Handler, Arg1>* this_handler)
90 boost_asio_handler_alloc_helpers::deallocate(
91 pointer, size, this_handler->handler_);
94 template <typename Handler, typename Arg1>
95 inline bool asio_handler_is_continuation(
96 binder1<Handler, Arg1>* this_handler)
98 return boost_asio_handler_cont_helpers::is_continuation(
99 this_handler->handler_);
102 template <typename Function, typename Handler, typename Arg1>
103 inline void asio_handler_invoke(Function& function,
104 binder1<Handler, Arg1>* this_handler)
106 boost_asio_handler_invoke_helpers::invoke(
107 function, this_handler->handler_);
110 template <typename Function, typename Handler, typename Arg1>
111 inline void asio_handler_invoke(const Function& function,
112 binder1<Handler, Arg1>* this_handler)
114 boost_asio_handler_invoke_helpers::invoke(
115 function, this_handler->handler_);
118 template <typename Handler, typename Arg1>
119 inline binder1<typename decay<Handler>::type, Arg1> bind_handler(
120 BOOST_ASIO_MOVE_ARG(Handler) handler, const Arg1& arg1)
122 return binder1<typename decay<Handler>::type, Arg1>(0,
123 BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1);
126 template <typename Handler, typename Arg1, typename Arg2>
130 template <typename T>
131 binder2(int, BOOST_ASIO_MOVE_ARG(T) handler,
132 const Arg1& arg1, const Arg2& arg2)
133 : handler_(BOOST_ASIO_MOVE_CAST(T)(handler)),
139 binder2(Handler& handler, const Arg1& arg1, const Arg2& arg2)
140 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
146 #if defined(BOOST_ASIO_HAS_MOVE)
147 binder2(const binder2& other)
148 : handler_(other.handler_),
154 binder2(binder2&& other)
155 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)),
156 arg1_(BOOST_ASIO_MOVE_CAST(Arg1)(other.arg1_)),
157 arg2_(BOOST_ASIO_MOVE_CAST(Arg2)(other.arg2_))
160 #endif // defined(BOOST_ASIO_HAS_MOVE)
164 handler_(static_cast<const Arg1&>(arg1_),
165 static_cast<const Arg2&>(arg2_));
168 void operator()() const
170 handler_(arg1_, arg2_);
179 template <typename Handler, typename Arg1, typename Arg2>
180 inline void* asio_handler_allocate(std::size_t size,
181 binder2<Handler, Arg1, Arg2>* this_handler)
183 return boost_asio_handler_alloc_helpers::allocate(
184 size, this_handler->handler_);
187 template <typename Handler, typename Arg1, typename Arg2>
188 inline void asio_handler_deallocate(void* pointer, std::size_t size,
189 binder2<Handler, Arg1, Arg2>* this_handler)
191 boost_asio_handler_alloc_helpers::deallocate(
192 pointer, size, this_handler->handler_);
195 template <typename Handler, typename Arg1, typename Arg2>
196 inline bool asio_handler_is_continuation(
197 binder2<Handler, Arg1, Arg2>* this_handler)
199 return boost_asio_handler_cont_helpers::is_continuation(
200 this_handler->handler_);
203 template <typename Function, typename Handler, typename Arg1, typename Arg2>
204 inline void asio_handler_invoke(Function& function,
205 binder2<Handler, Arg1, Arg2>* this_handler)
207 boost_asio_handler_invoke_helpers::invoke(
208 function, this_handler->handler_);
211 template <typename Function, typename Handler, typename Arg1, typename Arg2>
212 inline void asio_handler_invoke(const Function& function,
213 binder2<Handler, Arg1, Arg2>* this_handler)
215 boost_asio_handler_invoke_helpers::invoke(
216 function, this_handler->handler_);
219 template <typename Handler, typename Arg1, typename Arg2>
220 inline binder2<typename decay<Handler>::type, Arg1, Arg2> bind_handler(
221 BOOST_ASIO_MOVE_ARG(Handler) handler, const Arg1& arg1, const Arg2& arg2)
223 return binder2<typename decay<Handler>::type, Arg1, Arg2>(0,
224 BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1, arg2);
227 template <typename Handler, typename Arg1, typename Arg2, typename Arg3>
231 template <typename T>
232 binder3(int, BOOST_ASIO_MOVE_ARG(T) handler, const Arg1& arg1,
233 const Arg2& arg2, const Arg3& arg3)
234 : handler_(BOOST_ASIO_MOVE_CAST(T)(handler)),
241 binder3(Handler& handler, const Arg1& arg1,
242 const Arg2& arg2, const Arg3& arg3)
243 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
250 #if defined(BOOST_ASIO_HAS_MOVE)
251 binder3(const binder3& other)
252 : handler_(other.handler_),
259 binder3(binder3&& other)
260 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)),
261 arg1_(BOOST_ASIO_MOVE_CAST(Arg1)(other.arg1_)),
262 arg2_(BOOST_ASIO_MOVE_CAST(Arg2)(other.arg2_)),
263 arg3_(BOOST_ASIO_MOVE_CAST(Arg3)(other.arg3_))
266 #endif // defined(BOOST_ASIO_HAS_MOVE)
270 handler_(static_cast<const Arg1&>(arg1_),
271 static_cast<const Arg2&>(arg2_), static_cast<const Arg3&>(arg3_));
274 void operator()() const
276 handler_(arg1_, arg2_, arg3_);
286 template <typename Handler, typename Arg1, typename Arg2, typename Arg3>
287 inline void* asio_handler_allocate(std::size_t size,
288 binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
290 return boost_asio_handler_alloc_helpers::allocate(
291 size, this_handler->handler_);
294 template <typename Handler, typename Arg1, typename Arg2, typename Arg3>
295 inline void asio_handler_deallocate(void* pointer, std::size_t size,
296 binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
298 boost_asio_handler_alloc_helpers::deallocate(
299 pointer, size, this_handler->handler_);
302 template <typename Handler, typename Arg1, typename Arg2, typename Arg3>
303 inline bool asio_handler_is_continuation(
304 binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
306 return boost_asio_handler_cont_helpers::is_continuation(
307 this_handler->handler_);
310 template <typename Function, typename Handler,
311 typename Arg1, typename Arg2, typename Arg3>
312 inline void asio_handler_invoke(Function& function,
313 binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
315 boost_asio_handler_invoke_helpers::invoke(
316 function, this_handler->handler_);
319 template <typename Function, typename Handler,
320 typename Arg1, typename Arg2, typename Arg3>
321 inline void asio_handler_invoke(const Function& function,
322 binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
324 boost_asio_handler_invoke_helpers::invoke(
325 function, this_handler->handler_);
328 template <typename Handler, typename Arg1, typename Arg2, typename Arg3>
329 inline binder3<typename decay<Handler>::type, Arg1, Arg2, Arg3> bind_handler(
330 BOOST_ASIO_MOVE_ARG(Handler) handler, const Arg1& arg1, const Arg2& arg2,
333 return binder3<typename decay<Handler>::type, Arg1, Arg2, Arg3>(0,
334 BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1, arg2, arg3);
337 template <typename Handler, typename Arg1,
338 typename Arg2, typename Arg3, typename Arg4>
342 template <typename T>
343 binder4(int, BOOST_ASIO_MOVE_ARG(T) handler, const Arg1& arg1,
344 const Arg2& arg2, const Arg3& arg3, const Arg4& arg4)
345 : handler_(BOOST_ASIO_MOVE_CAST(T)(handler)),
353 binder4(Handler& handler, const Arg1& arg1,
354 const Arg2& arg2, const Arg3& arg3, const Arg4& arg4)
355 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
363 #if defined(BOOST_ASIO_HAS_MOVE)
364 binder4(const binder4& other)
365 : handler_(other.handler_),
373 binder4(binder4&& other)
374 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)),
375 arg1_(BOOST_ASIO_MOVE_CAST(Arg1)(other.arg1_)),
376 arg2_(BOOST_ASIO_MOVE_CAST(Arg2)(other.arg2_)),
377 arg3_(BOOST_ASIO_MOVE_CAST(Arg3)(other.arg3_)),
378 arg4_(BOOST_ASIO_MOVE_CAST(Arg4)(other.arg4_))
381 #endif // defined(BOOST_ASIO_HAS_MOVE)
385 handler_(static_cast<const Arg1&>(arg1_),
386 static_cast<const Arg2&>(arg2_), static_cast<const Arg3&>(arg3_),
387 static_cast<const Arg4&>(arg4_));
390 void operator()() const
392 handler_(arg1_, arg2_, arg3_, arg4_);
403 template <typename Handler, typename Arg1,
404 typename Arg2, typename Arg3, typename Arg4>
405 inline void* asio_handler_allocate(std::size_t size,
406 binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
408 return boost_asio_handler_alloc_helpers::allocate(
409 size, this_handler->handler_);
412 template <typename Handler, typename Arg1,
413 typename Arg2, typename Arg3, typename Arg4>
414 inline void asio_handler_deallocate(void* pointer, std::size_t size,
415 binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
417 boost_asio_handler_alloc_helpers::deallocate(
418 pointer, size, this_handler->handler_);
421 template <typename Handler, typename Arg1,
422 typename Arg2, typename Arg3, typename Arg4>
423 inline bool asio_handler_is_continuation(
424 binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
426 return boost_asio_handler_cont_helpers::is_continuation(
427 this_handler->handler_);
430 template <typename Function, typename Handler, typename Arg1,
431 typename Arg2, typename Arg3, typename Arg4>
432 inline void asio_handler_invoke(Function& function,
433 binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
435 boost_asio_handler_invoke_helpers::invoke(
436 function, this_handler->handler_);
439 template <typename Function, typename Handler, typename Arg1,
440 typename Arg2, typename Arg3, typename Arg4>
441 inline void asio_handler_invoke(const Function& function,
442 binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
444 boost_asio_handler_invoke_helpers::invoke(
445 function, this_handler->handler_);
448 template <typename Handler, typename Arg1,
449 typename Arg2, typename Arg3, typename Arg4>
450 inline binder4<typename decay<Handler>::type, Arg1, Arg2, Arg3, Arg4>
451 bind_handler(BOOST_ASIO_MOVE_ARG(Handler) handler, const Arg1& arg1,
452 const Arg2& arg2, const Arg3& arg3, const Arg4& arg4)
454 return binder4<typename decay<Handler>::type, Arg1, Arg2, Arg3, Arg4>(0,
455 BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1, arg2, arg3, arg4);
458 template <typename Handler, typename Arg1, typename Arg2,
459 typename Arg3, typename Arg4, typename Arg5>
463 template <typename T>
464 binder5(int, BOOST_ASIO_MOVE_ARG(T) handler, const Arg1& arg1,
465 const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5)
466 : handler_(BOOST_ASIO_MOVE_CAST(T)(handler)),
475 binder5(Handler& handler, const Arg1& arg1, const Arg2& arg2,
476 const Arg3& arg3, const Arg4& arg4, const Arg5& arg5)
477 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
486 #if defined(BOOST_ASIO_HAS_MOVE)
487 binder5(const binder5& other)
488 : handler_(other.handler_),
497 binder5(binder5&& other)
498 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)),
499 arg1_(BOOST_ASIO_MOVE_CAST(Arg1)(other.arg1_)),
500 arg2_(BOOST_ASIO_MOVE_CAST(Arg2)(other.arg2_)),
501 arg3_(BOOST_ASIO_MOVE_CAST(Arg3)(other.arg3_)),
502 arg4_(BOOST_ASIO_MOVE_CAST(Arg4)(other.arg4_)),
503 arg5_(BOOST_ASIO_MOVE_CAST(Arg5)(other.arg5_))
506 #endif // defined(BOOST_ASIO_HAS_MOVE)
510 handler_(static_cast<const Arg1&>(arg1_),
511 static_cast<const Arg2&>(arg2_), static_cast<const Arg3&>(arg3_),
512 static_cast<const Arg4&>(arg4_), static_cast<const Arg5&>(arg5_));
515 void operator()() const
517 handler_(arg1_, arg2_, arg3_, arg4_, arg5_);
529 template <typename Handler, typename Arg1, typename Arg2,
530 typename Arg3, typename Arg4, typename Arg5>
531 inline void* asio_handler_allocate(std::size_t size,
532 binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
534 return boost_asio_handler_alloc_helpers::allocate(
535 size, this_handler->handler_);
538 template <typename Handler, typename Arg1, typename Arg2,
539 typename Arg3, typename Arg4, typename Arg5>
540 inline void asio_handler_deallocate(void* pointer, std::size_t size,
541 binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
543 boost_asio_handler_alloc_helpers::deallocate(
544 pointer, size, this_handler->handler_);
547 template <typename Handler, typename Arg1, typename Arg2,
548 typename Arg3, typename Arg4, typename Arg5>
549 inline bool asio_handler_is_continuation(
550 binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
552 return boost_asio_handler_cont_helpers::is_continuation(
553 this_handler->handler_);
556 template <typename Function, typename Handler, typename Arg1,
557 typename Arg2, typename Arg3, typename Arg4, typename Arg5>
558 inline void asio_handler_invoke(Function& function,
559 binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
561 boost_asio_handler_invoke_helpers::invoke(
562 function, this_handler->handler_);
565 template <typename Function, typename Handler, typename Arg1,
566 typename Arg2, typename Arg3, typename Arg4, typename Arg5>
567 inline void asio_handler_invoke(const Function& function,
568 binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
570 boost_asio_handler_invoke_helpers::invoke(
571 function, this_handler->handler_);
574 template <typename Handler, typename Arg1, typename Arg2,
575 typename Arg3, typename Arg4, typename Arg5>
576 inline binder5<typename decay<Handler>::type, Arg1, Arg2, Arg3, Arg4, Arg5>
577 bind_handler(BOOST_ASIO_MOVE_ARG(Handler) handler, const Arg1& arg1,
578 const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5)
580 return binder5<typename decay<Handler>::type, Arg1, Arg2, Arg3, Arg4, Arg5>(0,
581 BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1, arg2, arg3, arg4, arg5);
584 #if defined(BOOST_ASIO_HAS_MOVE)
586 template <typename Handler, typename Arg1>
590 move_binder1(int, BOOST_ASIO_MOVE_ARG(Handler) handler,
591 BOOST_ASIO_MOVE_ARG(Arg1) arg1)
592 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
593 arg1_(BOOST_ASIO_MOVE_CAST(Arg1)(arg1))
597 move_binder1(move_binder1&& other)
598 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)),
599 arg1_(BOOST_ASIO_MOVE_CAST(Arg1)(other.arg1_))
605 handler_(BOOST_ASIO_MOVE_CAST(Arg1)(arg1_));
613 template <typename Handler, typename Arg1>
614 inline void* asio_handler_allocate(std::size_t size,
615 move_binder1<Handler, Arg1>* this_handler)
617 return boost_asio_handler_alloc_helpers::allocate(
618 size, this_handler->handler_);
621 template <typename Handler, typename Arg1>
622 inline void asio_handler_deallocate(void* pointer, std::size_t size,
623 move_binder1<Handler, Arg1>* this_handler)
625 boost_asio_handler_alloc_helpers::deallocate(
626 pointer, size, this_handler->handler_);
629 template <typename Handler, typename Arg1>
630 inline bool asio_handler_is_continuation(
631 move_binder1<Handler, Arg1>* this_handler)
633 return boost_asio_handler_cont_helpers::is_continuation(
634 this_handler->handler_);
637 template <typename Function, typename Handler, typename Arg1>
638 inline void asio_handler_invoke(BOOST_ASIO_MOVE_ARG(Function) function,
639 move_binder1<Handler, Arg1>* this_handler)
641 boost_asio_handler_invoke_helpers::invoke(
642 BOOST_ASIO_MOVE_CAST(Function)(function), this_handler->handler_);
645 template <typename Handler, typename Arg1, typename Arg2>
649 move_binder2(int, BOOST_ASIO_MOVE_ARG(Handler) handler,
650 const Arg1& arg1, BOOST_ASIO_MOVE_ARG(Arg2) arg2)
651 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
653 arg2_(BOOST_ASIO_MOVE_CAST(Arg2)(arg2))
657 move_binder2(move_binder2&& other)
658 : handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)),
659 arg1_(BOOST_ASIO_MOVE_CAST(Arg1)(other.arg1_)),
660 arg2_(BOOST_ASIO_MOVE_CAST(Arg2)(other.arg2_))
666 handler_(static_cast<const Arg1&>(arg1_),
667 BOOST_ASIO_MOVE_CAST(Arg2)(arg2_));
676 template <typename Handler, typename Arg1, typename Arg2>
677 inline void* asio_handler_allocate(std::size_t size,
678 move_binder2<Handler, Arg1, Arg2>* this_handler)
680 return boost_asio_handler_alloc_helpers::allocate(
681 size, this_handler->handler_);
684 template <typename Handler, typename Arg1, typename Arg2>
685 inline void asio_handler_deallocate(void* pointer, std::size_t size,
686 move_binder2<Handler, Arg1, Arg2>* this_handler)
688 boost_asio_handler_alloc_helpers::deallocate(
689 pointer, size, this_handler->handler_);
692 template <typename Handler, typename Arg1, typename Arg2>
693 inline bool asio_handler_is_continuation(
694 move_binder2<Handler, Arg1, Arg2>* this_handler)
696 return boost_asio_handler_cont_helpers::is_continuation(
697 this_handler->handler_);
700 template <typename Function, typename Handler, typename Arg1, typename Arg2>
701 inline void asio_handler_invoke(BOOST_ASIO_MOVE_ARG(Function) function,
702 move_binder2<Handler, Arg1, Arg2>* this_handler)
704 boost_asio_handler_invoke_helpers::invoke(
705 BOOST_ASIO_MOVE_CAST(Function)(function), this_handler->handler_);
708 #endif // defined(BOOST_ASIO_HAS_MOVE)
710 } // namespace detail
712 template <typename Handler, typename Arg1, typename Allocator>
713 struct associated_allocator<detail::binder1<Handler, Arg1>, Allocator>
715 typedef typename associated_allocator<Handler, Allocator>::type type;
717 static type get(const detail::binder1<Handler, Arg1>& h,
718 const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
720 return associated_allocator<Handler, Allocator>::get(h.handler_, a);
724 template <typename Handler, typename Arg1, typename Arg2, typename Allocator>
725 struct associated_allocator<detail::binder2<Handler, Arg1, Arg2>, Allocator>
727 typedef typename associated_allocator<Handler, Allocator>::type type;
729 static type get(const detail::binder2<Handler, Arg1, Arg2>& h,
730 const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
732 return associated_allocator<Handler, Allocator>::get(h.handler_, a);
736 template <typename Handler, typename Arg1, typename Executor>
737 struct associated_executor<detail::binder1<Handler, Arg1>, Executor>
739 typedef typename associated_executor<Handler, Executor>::type type;
741 static type get(const detail::binder1<Handler, Arg1>& h,
742 const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
744 return associated_executor<Handler, Executor>::get(h.handler_, ex);
748 template <typename Handler, typename Arg1, typename Arg2, typename Executor>
749 struct associated_executor<detail::binder2<Handler, Arg1, Arg2>, Executor>
751 typedef typename associated_executor<Handler, Executor>::type type;
753 static type get(const detail::binder2<Handler, Arg1, Arg2>& h,
754 const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
756 return associated_executor<Handler, Executor>::get(h.handler_, ex);
760 #if defined(BOOST_ASIO_HAS_MOVE)
762 template <typename Handler, typename Arg1, typename Allocator>
763 struct associated_allocator<detail::move_binder1<Handler, Arg1>, Allocator>
765 typedef typename associated_allocator<Handler, Allocator>::type type;
767 static type get(const detail::move_binder1<Handler, Arg1>& h,
768 const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
770 return associated_allocator<Handler, Allocator>::get(h.handler_, a);
774 template <typename Handler, typename Arg1, typename Arg2, typename Allocator>
775 struct associated_allocator<
776 detail::move_binder2<Handler, Arg1, Arg2>, Allocator>
778 typedef typename associated_allocator<Handler, Allocator>::type type;
780 static type get(const detail::move_binder2<Handler, Arg1, Arg2>& h,
781 const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
783 return associated_allocator<Handler, Allocator>::get(h.handler_, a);
787 template <typename Handler, typename Arg1, typename Executor>
788 struct associated_executor<detail::move_binder1<Handler, Arg1>, Executor>
790 typedef typename associated_executor<Handler, Executor>::type type;
792 static type get(const detail::move_binder1<Handler, Arg1>& h,
793 const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
795 return associated_executor<Handler, Executor>::get(h.handler_, ex);
799 template <typename Handler, typename Arg1, typename Arg2, typename Executor>
800 struct associated_executor<detail::move_binder2<Handler, Arg1, Arg2>, Executor>
802 typedef typename associated_executor<Handler, Executor>::type type;
804 static type get(const detail::move_binder2<Handler, Arg1, Arg2>& h,
805 const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
807 return associated_executor<Handler, Executor>::get(h.handler_, ex);
811 #endif // defined(BOOST_ASIO_HAS_MOVE)
816 #include <boost/asio/detail/pop_options.hpp>
818 #endif // BOOST_ASIO_DETAIL_BIND_HANDLER_HPP