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 ==============================================================================*/
8 #if !BOOST_PHOENIX_IS_ITERATING
10 #include <boost/phoenix/core/limits.hpp>
11 #include <boost/phoenix/support/iterate.hpp>
13 namespace boost { namespace phoenix { namespace detail
16 struct member_function_ptr_impl
18 template <typename RT, typename FP>
22 template <int N, typename RT, typename FP>
23 struct member_function_ptr
24 : member_function_ptr_impl<N>::template impl<RT, FP>
26 typedef typename member_function_ptr_impl<N>::
27 template impl<RT, FP> base;
28 member_function_ptr(FP fp_)
33 bool operator==(member_function_ptr const & rhs) const
38 template <int M, typename RhsRT, typename RhsFP>
39 bool operator==(member_function_ptr<M, RhsRT, RhsFP> const &) const
46 struct member_function_ptr_impl<0>
48 template <typename RT, typename FP>
51 typedef RT result_type;
56 template <typename Class>
57 RT operator()(Class& obj) const
59 BOOST_PROTO_USE_GET_POINTER();
61 typedef typename proto::detail::class_member_traits<FP>::class_type class_type;
62 return (BOOST_PROTO_GET_POINTER(class_type, obj) ->*fp)();
65 template <typename Class>
66 RT operator()(Class* obj) const
75 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
76 #include <boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr.hpp>
79 #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
80 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/member_function_ptr_" BOOST_PHOENIX_LIMIT_STR ".hpp")
83 /*=============================================================================
84 Copyright (c) 2001-2007 Joel de Guzman
86 Distributed under the Boost Software License, Version 1.0. (See accompanying
87 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
88 ==============================================================================*/
90 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
91 #pragma wave option(preserve: 1)
94 #define BOOST_PHOENIX_ITERATION_PARAMS \
95 (3, (1, BOOST_PHOENIX_COMPOSITE_LIMIT, \
96 <boost/phoenix/bind/detail/cpp03/member_function_ptr.hpp>))
97 #include BOOST_PHOENIX_ITERATE()
99 #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
100 #pragma wave option(output: null)
105 }}} // namespace boost::phoenix::detail
107 ///////////////////////////////////////////////////////////////////////////////
109 // Preprocessor vertical repetition code
111 ///////////////////////////////////////////////////////////////////////////////
115 struct member_function_ptr_impl<BOOST_PHOENIX_ITERATION>
117 template <typename RT, typename FP>
120 typedef RT result_type;
125 template <typename Class, BOOST_PHOENIX_typename_A>
126 RT operator()(Class& obj, BOOST_PHOENIX_A_ref_a) const
128 BOOST_PROTO_USE_GET_POINTER();
130 typedef typename proto::detail::class_member_traits<FP>::class_type class_type;
131 return (BOOST_PROTO_GET_POINTER(class_type, obj)->*fp)(BOOST_PHOENIX_a);
134 template <typename Class, BOOST_PHOENIX_typename_A>
135 RT operator()(Class* obj, BOOST_PHOENIX_A_ref_a) const
137 return (obj->*fp)(BOOST_PHOENIX_a);
144 #endif // defined(BOOST_PP_IS_ITERATING)