2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BEAST_BIND_DETAIL_HANDLER_HPP
9 #define BEAST_BIND_DETAIL_HANDLER_HPP
11 #include <beast/core/handler_helpers.hpp>
12 #include <beast/core/detail/integer_sequence.hpp>
18 /* Nullary handler that calls Handler with bound arguments.
20 The bound handler provides the same io_service execution
21 guarantees as the original handler.
23 template<class Handler, class... Args>
27 using args_type = std::tuple<
28 typename std::decay<Args>::type...>;
33 template<class Tuple, std::size_t... S>
34 static void invoke(Handler& h, Tuple& args,
37 h(std::get<S>(args)...);
41 using result_type = void;
43 template<class DeducedHandler>
46 DeducedHandler&& handler, Args&&... args)
47 : h_(std::forward<DeducedHandler>(handler))
48 , args_(std::forward<Args>(args)...)
56 index_sequence_for<Args...>());
63 index_sequence_for<Args...>());
68 asio_handler_allocate(
69 std::size_t size, bound_handler* h)
71 return beast_asio_helpers::
72 allocate(size, h->h_);
77 asio_handler_deallocate(
78 void* p, std::size_t size, bound_handler* h)
81 deallocate(p, size, h->h_);
86 asio_handler_is_continuation(bound_handler* h)
88 return beast_asio_helpers::
89 is_continuation (h->h_);
95 asio_handler_invoke(F&& f, bound_handler* h)
105 #include <functional>
108 template<class Handler, class... Args>
110 bind(beast::detail::bound_handler<
111 Handler, Args...>, ...) = delete;