/*============================================================================= Copyright (c) 2016 Kohei Takahashi Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #ifndef PHOENIX_BIND_BIND_MEMBER_FUNCTION_HPP #define PHOENIX_BIND_BIND_MEMBER_FUNCTION_HPP #include #if defined(BOOST_PHOENIX_NO_VARIADIC_BIND) # include #else #include #include #include namespace boost { namespace phoenix { namespace detail { template struct member_function_ptr { typedef RT result_type; member_function_ptr(FP fp_) : fp(fp_) {} template result_type operator()(Class& obj, A&... a) const { BOOST_PROTO_USE_GET_POINTER(); typedef typename proto::detail::class_member_traits::class_type class_type; return (BOOST_PROTO_GET_POINTER(class_type, obj)->*fp)(a...); } template result_type operator()(Class* obj, A&... a) const { return (obj->*fp)(a...); } bool operator==(member_function_ptr const& rhs) const { return fp == rhs.fp; } template bool operator==(member_function_ptr const& /*rhs*/) const { return false; } FP fp; }; } // namespace boost::phoenix::detail template inline typename detail::expression::function_eval< detail::member_function_ptr , ClassA , A... >::type const bind(RT (ClassT::*f)(T...), ClassA const & obj, A const&... a) { typedef detail::member_function_ptr fp_type; return detail::expression::function_eval::make(fp_type(f), obj, a...); } template inline typename detail::expression::function_eval< detail::member_function_ptr , ClassA , A... >::type const bind(RT (ClassT::*f)(T...) const, ClassA const & obj, A const&... a) { typedef detail::member_function_ptr fp_type; return detail::expression::function_eval::make(fp_type(f), obj, a...); } template inline typename detail::expression::function_eval< detail::member_function_ptr , ClassT , A... >::type const bind(RT (ClassT::*f)(T...), ClassT & obj, A const&... a) { typedef detail::member_function_ptr fp_type; return detail::expression::function_eval::make(fp_type(f), obj, a...); } template inline typename detail::expression::function_eval< detail::member_function_ptr , ClassT , A... >::type const bind(RT (ClassT::*f)(T...) const, ClassT const& obj, A const&... a) { typedef detail::member_function_ptr fp_type; return detail::expression::function_eval::make(fp_type(f), obj, a...); } }} // namespace boost::phoenix #endif #endif