1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #ifndef BOOST_PHOENIX_CORE_DETAIL_MEMBER_VARIABLE_HPP
8 #define BOOST_PHOENIX_CORE_DETAIL_MEMBER_VARIABLE_HPP
10 #include <boost/proto/detail/decltype.hpp>
11 #include <boost/type_traits/remove_pointer.hpp>
15 #pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
18 namespace boost { namespace phoenix { namespace detail {
20 template <typename RT, typename MP>
21 struct member_variable
23 template <typename Sig>
26 template <typename This, typename Class>
27 struct result<This(Class)>
28 : result<This(Class const &)>
31 template <typename This, typename Class>
32 struct result<This(Class &)>
34 typedef typename boost::mpl::if_c<
36 typename boost::remove_pointer<
37 typename boost::remove_reference<Class>::type
46 member_variable(MP mp_)
49 template <typename Class>
50 RT& operator()(Class& obj) const
52 BOOST_PROTO_USE_GET_POINTER();
54 typedef typename proto::detail::class_member_traits<MP>::class_type class_type;
55 return (BOOST_PROTO_GET_POINTER(class_type, obj)->*mp);
58 template <typename Class>
59 RT& operator()(Class* obj) const
64 template <typename Class>
65 RT const& operator()(Class const& obj) const
67 BOOST_PROTO_USE_GET_POINTER();
69 typedef typename proto::detail::class_member_traits<MP>::class_type class_type;
70 return (BOOST_PROTO_GET_POINTER(class_type, obj)->*mp);
73 template <typename Class>
74 RT const& operator()(Class const* obj) const