Chris@16
|
1
|
Chris@16
|
2 #if !BOOST_PHOENIX_IS_ITERATING
|
Chris@16
|
3
|
Chris@16
|
4 #ifndef BOOST_PHOENIX_OPERATOR_MEMBER_HPP
|
Chris@16
|
5 #define BOOST_PHOENIX_OPERATOR_MEMBER_HPP
|
Chris@16
|
6
|
Chris@16
|
7 #include <boost/phoenix/core/limits.hpp>
|
Chris@16
|
8 #include <boost/get_pointer.hpp>
|
Chris@16
|
9 #include <boost/phoenix/core/domain.hpp>
|
Chris@16
|
10 #include <boost/phoenix/core/meta_grammar.hpp>
|
Chris@16
|
11 #include <boost/phoenix/core/call.hpp>
|
Chris@16
|
12 #include <boost/phoenix/operator/detail/mem_fun_ptr_gen.hpp>
|
Chris@16
|
13 #include <boost/phoenix/support/iterate.hpp>
|
Chris@16
|
14 #include <boost/type_traits/remove_reference.hpp>
|
Chris@16
|
15 #include <boost/type_traits/is_member_function_pointer.hpp>
|
Chris@16
|
16 #include <boost/proto/operators.hpp>
|
Chris@16
|
17
|
Chris@16
|
18 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
Chris@16
|
19
|
Chris@16
|
20 #include <boost/phoenix/operator/preprocessed/member.hpp>
|
Chris@16
|
21
|
Chris@16
|
22 #else
|
Chris@16
|
23
|
Chris@16
|
24 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
25 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/member_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
Chris@16
|
26 #endif
|
Chris@16
|
27
|
Chris@16
|
28 /*==============================================================================
|
Chris@16
|
29 Copyright (c) 2005-2010 Joel de Guzman
|
Chris@16
|
30 Copyright (c) 2010 Thomas Heller
|
Chris@16
|
31
|
Chris@16
|
32 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
33 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
34 ==============================================================================*/
|
Chris@16
|
35
|
Chris@16
|
36 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
37 #pragma wave option(preserve: 1)
|
Chris@16
|
38 #endif
|
Chris@16
|
39
|
Chris@16
|
40 #include <boost/phoenix/operator/detail/define_operator.hpp>
|
Chris@16
|
41
|
Chris@16
|
42 namespace boost { namespace phoenix
|
Chris@16
|
43 {
|
Chris@16
|
44 BOOST_PHOENIX_BINARY_OPERATORS((mem_ptr))
|
Chris@16
|
45
|
Chris@16
|
46 template<>
|
Chris@16
|
47 struct phoenix_generator::case_<proto::tag::mem_ptr>
|
Chris@16
|
48 : proto::or_<
|
Chris@16
|
49 proto::when<
|
Chris@16
|
50 proto::and_<
|
Chris@16
|
51 proto::mem_ptr<meta_grammar, proto::terminal<proto::_> >
|
Chris@16
|
52 , proto::if_<is_member_function_pointer<boost::remove_reference<proto::call<proto::_value(proto::_right)> > >()>
|
Chris@16
|
53 >
|
Chris@16
|
54 , proto::call<detail::make_mem_fun_ptr_gen(proto::_left, proto::call<proto::_value(proto::_right)>)>
|
Chris@16
|
55 >
|
Chris@16
|
56 , proto::otherwise<
|
Chris@16
|
57 proto::call<proto::pod_generator<actor>(proto::_)>
|
Chris@16
|
58 >
|
Chris@16
|
59 >
|
Chris@16
|
60 {};
|
Chris@16
|
61
|
Chris@16
|
62 namespace result_of
|
Chris@16
|
63 {
|
Chris@16
|
64 template <
|
Chris@16
|
65 typename Context
|
Chris@16
|
66 , BOOST_PHOENIX_typename_A_void(BOOST_PHOENIX_LIMIT)
|
Chris@16
|
67 , typename Dummy = void
|
Chris@16
|
68 >
|
Chris@16
|
69 struct mem_fun_ptr_eval;
|
Chris@16
|
70
|
Chris@16
|
71 #include <boost/phoenix/operator/detail/mem_fun_ptr_eval_result_of.hpp>
|
Chris@16
|
72 }
|
Chris@16
|
73
|
Chris@16
|
74 struct mem_fun_ptr_eval
|
Chris@16
|
75 {
|
Chris@16
|
76 template<typename Sig>
|
Chris@16
|
77 struct result;
|
Chris@16
|
78
|
Chris@16
|
79 #define BOOST_PHOENIX_MEMBER_EVAL(Z, N, D) \
|
Chris@16
|
80 BOOST_PP_COMMA_IF(BOOST_PP_NOT(BOOST_PP_EQUAL(N, 2))) \
|
Chris@16
|
81 boost::phoenix::eval(BOOST_PP_CAT(a, N), ctx) \
|
Chris@16
|
82 /**/
|
Chris@16
|
83
|
Chris@16
|
84 #define BOOST_PHOENIX_ITERATION_PARAMS \
|
Chris@16
|
85 (3, (2, BOOST_PHOENIX_LIMIT, \
|
Chris@16
|
86 <boost/phoenix/operator/member.hpp>)) \
|
Chris@16
|
87 /**/
|
Chris@16
|
88 #include BOOST_PHOENIX_ITERATE()
|
Chris@16
|
89 #undef BOOST_PHOENIX_MEMBER_EVAL
|
Chris@16
|
90 };
|
Chris@16
|
91
|
Chris@16
|
92 template <typename Dummy>
|
Chris@16
|
93 struct default_actions::when<rule::mem_fun_ptr, Dummy>
|
Chris@16
|
94 : call<mem_fun_ptr_eval>
|
Chris@16
|
95 {};
|
Chris@16
|
96 }}
|
Chris@16
|
97
|
Chris@16
|
98 #include <boost/phoenix/operator/detail/undef_operator.hpp>
|
Chris@16
|
99
|
Chris@16
|
100 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
101 #pragma wave option(output: null)
|
Chris@16
|
102 #endif
|
Chris@16
|
103
|
Chris@16
|
104 #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
Chris@16
|
105
|
Chris@16
|
106 #endif
|
Chris@16
|
107
|
Chris@16
|
108 #else // BOOST_PHOENIX_IS_ITERATING
|
Chris@16
|
109
|
Chris@16
|
110 template <typename This, BOOST_PHOENIX_typename_A, typename Context>
|
Chris@16
|
111 struct result<This(BOOST_PHOENIX_A, Context)>
|
Chris@16
|
112 : result<This(BOOST_PHOENIX_A_const_ref, Context)>
|
Chris@16
|
113 {};
|
Chris@16
|
114
|
Chris@16
|
115 template <typename This, BOOST_PHOENIX_typename_A, typename Context>
|
Chris@16
|
116 struct result<This(BOOST_PHOENIX_A_ref, Context)>
|
Chris@16
|
117 : result_of::mem_fun_ptr_eval<Context, BOOST_PHOENIX_A>
|
Chris@16
|
118 {};
|
Chris@16
|
119
|
Chris@16
|
120 template <BOOST_PHOENIX_typename_A, typename Context>
|
Chris@16
|
121 typename result_of::mem_fun_ptr_eval<Context, BOOST_PHOENIX_A>::type
|
Chris@16
|
122 operator()(
|
Chris@16
|
123 BOOST_PHOENIX_A_const_ref_a
|
Chris@16
|
124 , Context const & ctx
|
Chris@16
|
125 ) const
|
Chris@16
|
126 {
|
Chris@16
|
127 return
|
Chris@16
|
128 (
|
Chris@16
|
129 get_pointer(boost::phoenix::eval(a0, ctx))
|
Chris@16
|
130 ->*boost::phoenix::eval(a1, ctx)
|
Chris@16
|
131 )(
|
Chris@16
|
132 BOOST_PP_REPEAT_FROM_TO(
|
Chris@16
|
133 2
|
Chris@16
|
134 , BOOST_PHOENIX_ITERATION
|
Chris@16
|
135 , BOOST_PHOENIX_MEMBER_EVAL
|
Chris@16
|
136 , BOOST_PHOENIX_ITERATION
|
Chris@16
|
137 )
|
Chris@16
|
138 );
|
Chris@16
|
139 }
|
Chris@16
|
140
|
Chris@16
|
141
|
Chris@16
|
142 #endif
|