diff --git a/CHANGELOG.md b/CHANGELOG.md index f76a7f84..79d501d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Version 191: * Use bind_front_handler * Simplify some type traits * Use lean_tuple in buffers_cat +* Use lean_tuple in bind_handler, bind_front_handler -------------------------------------------------------------------------------- diff --git a/include/boost/beast/core/detail/bind_handler.hpp b/include/boost/beast/core/detail/bind_handler.hpp index ad39de13..02338732 100644 --- a/include/boost/beast/core/detail/bind_handler.hpp +++ b/include/boost/beast/core/detail/bind_handler.hpp @@ -11,7 +11,7 @@ #define BOOST_BEAST_DETAIL_BIND_HANDLER_HPP #include -#include +#include #include #include #include @@ -22,6 +22,8 @@ #include #include +#include + namespace boost { namespace beast { namespace detail { @@ -29,7 +31,7 @@ namespace detail { template class bind_wrapper { - using args_type = std::tuple< + using args_type = detail::lean_tuple< typename std::decay::type...>; Handler h_; @@ -59,13 +61,12 @@ class bind_wrapper typename std::enable_if< std::is_placeholder::type>::value != 0, - typename std::tuple_element< - std::is_placeholder< - typename std::decay::type>::value - 1, - Vals>>::type::type&& + tuple_element::type>::value - 1, + Vals>>::type&& extract(Arg&&, Vals&& vals) { - return std::get::type>::value - 1>( std::forward(vals)); } @@ -75,13 +76,12 @@ class bind_wrapper typename std::enable_if< boost::is_placeholder::type>::value != 0, - typename std::tuple_element< - boost::is_placeholder< - typename std::decay::type>::value - 1, - Vals>>::type::type&& + tuple_element::type>::value - 1, + Vals>>::type&& extract(Arg&&, Vals&& vals) { - return std::get::type>::value - 1>( std::forward(vals)); } @@ -92,13 +92,13 @@ class bind_wrapper static void invoke( - Handler& w, + Handler& h, ArgsTuple& args, - std::tuple<>&&, - index_sequence) + lean_tuple<>&&, + mp11::index_sequence) { boost::ignore_unused(args); - w(std::get(std::move(args))...); + h(detail::get(std::move(args))...); } template< @@ -108,14 +108,14 @@ class bind_wrapper static void invoke( - Handler& w, + Handler& h, ArgsTuple& args, ValsTuple&& vals, - index_sequence) + mp11::index_sequence) { boost::ignore_unused(args); boost::ignore_unused(vals); - w(extract(std::get(std::move(args)), + h(extract(detail::get(std::move(args)), std::forward(vals))...); } @@ -164,9 +164,9 @@ public: operator()(Values&&... values) { invoke(h_, args_, - std::forward_as_tuple( + lean_tuple( std::forward(values)...), - index_sequence_for()); + mp11::index_sequence_for()); } template @@ -174,9 +174,9 @@ public: operator()(Values&&... values) const { invoke(h_, args_, - std::forward_as_tuple( + lean_tuple( std::forward(values)...), - index_sequence_for()); + mp11::index_sequence_for()); } }; @@ -367,7 +367,7 @@ template class bind_front_wrapper { - using args_type = std::tuple< + using args_type = lean_tuple< typename std::decay::type, typename std::decay::type, typename std::decay::type, @@ -384,10 +384,10 @@ class bind_front_wrapper template void invoke( - boost::mp11::index_sequence, + mp11::index_sequence, Ts&&... ts) { - h_( std::get(std::move(args_))..., + h_( detail::get(std::move(args_))..., std::forward(ts)...); } @@ -439,7 +439,7 @@ public: void operator()(Ts&&... ts) { invoke( - boost::mp11::index_sequence_for< + mp11::index_sequence_for< Arg1, Arg2, Arg3, Args...>{}, std::forward(ts)...); } diff --git a/include/boost/beast/core/detail/lean_tuple.hpp b/include/boost/beast/core/detail/lean_tuple.hpp index 64cc91a6..9539844b 100644 --- a/include/boost/beast/core/detail/lean_tuple.hpp +++ b/include/boost/beast/core/detail/lean_tuple.hpp @@ -77,7 +77,7 @@ get(lean_tuple_element&& te) } template -using tuple_element_t = typename boost::copy_cv< +using tuple_element = typename boost::copy_cv< mp11::mp_at_c::type, I>, T>::type; } // detail