10 #ifndef BOOST_BEAST_DETAIL_BIND_HANDLER_HPP 11 #define BOOST_BEAST_DETAIL_BIND_HANDLER_HPP 14 #include <boost/asio/handler_alloc_hook.hpp> 15 #include <boost/asio/handler_continuation_hook.hpp> 16 #include <boost/asio/handler_invoke_hook.hpp> 17 #include <boost/core/ignore_unused.hpp> 30 template<
class Handler,
class... Args>
34 using args_type = std::tuple<
35 typename std::decay<Args>::type...>;
40 template<
class Arg,
class Vals>
42 typename std::enable_if<
43 std::is_placeholder<
typename 44 std::decay<Arg>::type>::value == 0,
46 extract(Arg&& arg, Vals& vals)
48 boost::ignore_unused(vals);
52 template<
class Arg,
class Vals>
54 typename std::enable_if<
55 std::is_placeholder<
typename 56 std::decay<Arg>::type>::value != 0,
57 typename std::tuple_element<
59 typename std::decay<Arg>::type>::value - 1,
61 extract(Arg&&, Vals&& vals)
63 return std::get<std::is_placeholder<
64 typename std::decay<Arg>::type>::value - 1>(
65 std::forward<Vals>(vals));
79 boost::ignore_unused(args);
80 h(std::get<S>(args)...);
95 boost::ignore_unused(args);
96 boost::ignore_unused(vals);
97 h(extract(std::get<S>(args),
98 std::forward<ValsTuple>(vals))...);
107 template<
class DeducedHandler>
110 DeducedHandler&& handler, Args&&... args)
111 : h_(
std::forward<DeducedHandler>(handler))
112 , args_(
std::forward<Args>(args)...)
116 template<
class... Values>
121 std::forward_as_tuple(
122 std::forward<Values>(values)...),
126 template<
class... Values>
131 std::forward_as_tuple(
132 std::forward<Values>(values)...),
141 using boost::asio::asio_handler_allocate;
143 size, std::addressof(h->h_));
151 using boost::asio::asio_handler_deallocate;
153 p, size, std::addressof(h->h_));
160 using boost::asio::asio_handler_is_continuation;
169 using boost::asio::asio_handler_invoke;
171 f, std::addressof(h->h_));
180 template<
class Handler,
class... Args>
183 Handler, Args...>, ...) =
delete;
Definition: async_result.hpp:20
make_index_sequence< sizeof_workaround< Args... >::size > index_sequence_for
Definition: integer_sequence.hpp:135
friend bool asio_handler_is_continuation(bound_handler *h)
Definition: bind_handler.hpp:158
bound_handler(DeducedHandler &&handler, Args &&...args)
Definition: bind_handler.hpp:109
Definition: integer_sequence.hpp:23
void result_type
Definition: bind_handler.hpp:102
friend void * asio_handler_allocate(std::size_t size, bound_handler *h)
Definition: bind_handler.hpp:138
Definition: bind_handler.hpp:31
bound_handler(bound_handler &&)=default
friend void asio_handler_invoke(F &&f, bound_handler *h)
Definition: bind_handler.hpp:167
void operator()(Values &&...values)
Definition: bind_handler.hpp:118
void operator()(Values &&...values) const
Definition: bind_handler.hpp:128
friend void asio_handler_deallocate(void *p, std::size_t size, bound_handler *h)
Definition: bind_handler.hpp:148