Index: boost/spirit/home/phoenix/bind/bind_member_variable.hpp =================================================================== --- boost/spirit/home/phoenix/bind/bind_member_variable.hpp (revision 49591) +++ boost/spirit/home/phoenix/bind/bind_member_variable.hpp (working copy) @@ -7,6 +7,11 @@ #ifndef PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP #define PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP +#include +#include +#include +#include + #include #include #include @@ -22,7 +27,15 @@ template struct result { - typedef RT& type; + 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) @@ -40,6 +53,18 @@ return obj->*mp; } + template + const RT& operator()(const Class& obj) const + { + return obj.*mp; + } + + template + const RT& operator()(const Class* obj) const + { + return obj->*mp; + } + MP mp; }; }