From 92add2afa6bdfdd48f87a224f41633efe6fa88b2 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 14 Feb 2019 16:16:04 -0800 Subject: [PATCH] bind_front_handler works with member functions --- CHANGELOG.md | 1 + include/boost/beast/core/detail/bind_handler.hpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) 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)...); }