diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa3cec3..02c55cd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Version 215: * basic_stream uses boost::shared_ptr * Remove bind_back_handler +* bind_front_handler works with member functions -------------------------------------------------------------------------------- diff --git a/include/boost/beast/core/detail/bind_handler.hpp b/include/boost/beast/core/detail/bind_handler.hpp index 915688cd..b6a490ab 100644 --- a/include/boost/beast/core/detail/bind_handler.hpp +++ b/include/boost/beast/core/detail/bind_handler.hpp @@ -217,6 +217,7 @@ class bind_front_wrapper template void invoke( + std::false_type, mp11::index_sequence, Ts&&... ts) { @@ -224,6 +225,18 @@ class bind_front_wrapper std::forward(ts)...); } + template + void + invoke( + std::true_type, + mp11::index_sequence, + Ts&&... ts) + { + std::mem_fn(h_)( + detail::get(std::move(args_))..., + std::forward(ts)...); + } + public: using result_type = void; // asio needs this @@ -243,6 +256,7 @@ public: void operator()(Ts&&... ts) { invoke( + std::is_member_function_pointer{}, mp11::index_sequence_for{}, std::forward(ts)...); }