1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
3 Copyright (c) 2014 John Fletcher
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
9 #ifndef PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP
10 #define PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP
12 #include <boost/utility/enable_if.hpp>
13 #include <boost/type_traits/is_member_function_pointer.hpp>
14 #include <boost/phoenix/core/expression.hpp>
15 #include <boost/phoenix/core/detail/function_eval.hpp>
16 #include <boost/phoenix/bind/detail/member_variable.hpp>
18 namespace boost { namespace phoenix
20 template <typename RT, typename ClassT, typename ClassA>
22 typename boost::lazy_disable_if<
23 boost::is_member_function_pointer<RT (ClassT::*)>,
24 typename detail::expression::function_eval<
25 detail::member_variable<RT, RT ClassT::*>
28 bind(RT ClassT::*mp, ClassA const& obj)
30 typedef detail::member_variable<RT, RT ClassT::*> mp_type;
32 detail::expression::function_eval<mp_type, ClassA>
33 ::make(mp_type(mp), obj);
36 template <typename RT, typename ClassT>
38 typename boost::lazy_disable_if<
39 boost::is_member_function_pointer<RT (ClassT::*)>,
40 typename detail::expression::function_eval<
41 detail::member_variable<RT, RT ClassT::*>
44 bind(RT ClassT::*mp, ClassT& obj)
46 typedef detail::member_variable<RT, RT ClassT::*> mp_type;
48 detail::expression::function_eval<
51 >::make(mp_type(mp), obj);