/*============================================================================= Copyright (c) 2001-2007 Joel de Guzman 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_VARIABLE_HPP #define PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace phoenix { namespace detail { template struct member_variable { template struct result { typedef typename boost::mpl::if_< boost::is_const< typename boost::remove_pointer< typename boost::remove_reference::type >::type > , const RT& , RT& >::type type; }; member_variable(MP mp) : mp(mp) {} template RT& operator()(Class& obj) const { return obj.*mp; } template RT& operator()(Class* obj) const { return obj->*mp; } template RT const& operator()(Class const& obj) const { return obj.*mp; } template RT const& operator()(Class const* obj) const { return obj->*mp; } MP mp; }; } template inline actor< typename as_composite< detail::function_eval<1> , detail::member_variable , ClassA >::type> bind(RT ClassT::*mp, ClassA const& obj) { typedef detail::member_variable mp_type; return compose >(mp_type(mp), obj); } template inline actor< typename as_composite< detail::function_eval<1> , detail::member_variable , actor > >::type> bind(RT ClassT::*mp, ClassT& obj) { typedef detail::member_variable mp_type; return compose >( mp_type(mp) , actor >(reference(obj))); } }} #endif