]> git.sesse.net Git - casparcg/blob - dependencies/boost/boost/phoenix/core/detail/actor_operator.hpp
Manually merged pull request #222
[casparcg] / dependencies / boost / boost / phoenix / core / detail / actor_operator.hpp
1
2 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
3 #ifndef BOOST_PHOENIX_CORE_DETAIL_ACTOR_OPERATOR_HPP
4 #define BOOST_PHOENIX_CORE_DETAIL_ACTOR_OPERATOR_HPP
5
6 #include <boost/phoenix/support/iterate.hpp>
7
8 #include <boost/phoenix/core/detail/preprocessed/actor_operator.hpp>
9
10 #endif
11 #else
12
13 #if !BOOST_PHOENIX_IS_ITERATING
14
15 #ifndef BOOST_PHOENIX_CORE_DETAIL_ACTOR_OPERATOR_HPP
16 #define BOOST_PHOENIX_CORE_DETAIL_ACTOR_OPERATOR_HPP
17
18 #include <boost/phoenix/support/iterate.hpp>
19
20 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
21 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/actor_operator_" BOOST_PHOENIX_LIMIT_STR ".hpp")
22 #endif
23 /*==============================================================================
24     Copyright (c) 2005-2010 Joel de Guzman
25     Copyright (c) 2010 Thomas Heller
26
27     Distributed under the Boost Software License, Version 1.0. (See accompanying
28     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
29 ==============================================================================*/
30
31 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
32 #pragma wave option(preserve: 1)
33 #endif
34
35 #define M0(Z, N, D)                                                             \
36     typename detail::result_type_deduction_helper<BOOST_PP_CAT(A, N)>::type     \
37 /**/
38
39 #define BOOST_PHOENIX_ITERATION_PARAMS                                          \
40         (3, (1, BOOST_PHOENIX_ACTOR_LIMIT,                                      \
41         <boost/phoenix/core/detail/actor_operator.hpp>))
42 #include BOOST_PHOENIX_ITERATE()
43
44 #undef M0
45
46 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
47 #pragma wave option(output: null)
48 #endif
49
50 #endif
51
52 #else
53
54 #if BOOST_PHOENIX_ITERATION >= BOOST_PHOENIX_PERFECT_FORWARD_LIMIT
55
56         template <typename This, BOOST_PHOENIX_typename_A>
57         struct result<This(BOOST_PHOENIX_A)>
58             : result<This(BOOST_PHOENIX_A_const_ref)>
59         {};
60
61         template <typename This, BOOST_PHOENIX_typename_A>
62         struct result<This(BOOST_PHOENIX_A_ref)>
63             : result_of::actor<proto_base_expr, BOOST_PHOENIX_A_ref>
64         {};
65
66         template <BOOST_PHOENIX_typename_A>
67         typename result_of::actor<proto_base_expr, BOOST_PHOENIX_A_ref>::type
68         operator()(BOOST_PHOENIX_A_ref_a)
69         {
70             typedef
71                 BOOST_PP_CAT(vector, BOOST_PP_INC(BOOST_PHOENIX_ITERATION))<
72                     const actor<Expr> *, BOOST_PHOENIX_A_ref
73                 >
74                 env_type;
75             env_type env = {this, BOOST_PHOENIX_a};
76             
77             return phoenix::eval(*this, phoenix::context(env, default_actions()));
78         }
79
80         template <BOOST_PHOENIX_typename_A>
81         typename result_of::actor<proto_base_expr, BOOST_PHOENIX_A_ref>::type
82         operator()(BOOST_PHOENIX_A_ref_a) const
83         {
84             typedef
85                 BOOST_PP_CAT(vector, BOOST_PP_INC(BOOST_PHOENIX_ITERATION))<
86                     const actor<Expr> *, BOOST_PHOENIX_A_ref
87                 >
88                 env_type;
89             env_type env = {this, BOOST_PHOENIX_a};
90             
91             return phoenix::eval(*this, phoenix::context(env, default_actions()));
92         }
93
94         template <BOOST_PHOENIX_typename_A>
95         typename result_of::actor<proto_base_expr, BOOST_PHOENIX_A_const_ref>::type
96         operator()(BOOST_PHOENIX_A_const_ref_a)
97         {
98             typedef
99                 BOOST_PP_CAT(vector, BOOST_PP_INC(BOOST_PHOENIX_ITERATION))<
100                     const actor<Expr> *, BOOST_PHOENIX_A_const_ref
101                 >
102                 env_type;
103             env_type env = {this, BOOST_PHOENIX_a};
104             
105             return phoenix::eval(*this, phoenix::context(env, default_actions()));
106         }
107
108         template <BOOST_PHOENIX_typename_A>
109         typename result_of::actor<proto_base_expr, BOOST_PHOENIX_A_const_ref>::type
110         operator()(BOOST_PHOENIX_A_const_ref_a) const
111         {
112             typedef
113                 BOOST_PP_CAT(vector, BOOST_PP_INC(BOOST_PHOENIX_ITERATION))<
114                     const actor<Expr> *, BOOST_PHOENIX_A_const_ref
115                 >
116                 env_type;
117             env_type env = {this, BOOST_PHOENIX_a};
118             
119             return phoenix::eval(*this, phoenix::context(env, default_actions()));
120         }
121
122 #else
123
124 // We need to define operator() for all permutations of reference types.
125 // For BOOST_PHOENIX_ITERATION <= BOOST_PHOENIX_LIMIT_PREFECT_FORWARD
126 // 2^BOOST_PHOENIX_ITERATION overloads are created
127 // For compile time reasons,
128 // if BOOST_PHOENIX_ITERATION > BOOST_PHOENIX_LIMIT_PERFECT_FORWARD
129 // only operator()(A const &...a) and operator()(A &...a) are generated
130 // this is all handled by the PP mumbo jumbo above
131 #define BOOST_PHOENIX_ACTOR_OPERATOR(_, I, __)                                  \
132         template <typename This, BOOST_PHOENIX_typename_A>                      \
133         struct result<This(BOOST_PHOENIX_PERM_A(I))>                            \
134             : result_of::actor<proto_base_expr, BOOST_PHOENIX_PERM_A(I)>        \
135         {};                                                                     \
136                                                                                 \
137         template <BOOST_PHOENIX_typename_A>                                     \
138         typename result_of::actor<proto_base_expr, BOOST_PHOENIX_PERM_A(I)>::type\
139         operator()(BOOST_PHOENIX_PERM_A_a(I)) const                             \
140         {                                                                       \
141             typedef                                                             \
142                 BOOST_PP_CAT(vector, BOOST_PP_INC(BOOST_PHOENIX_ITERATION))<    \
143                     const actor<Expr> *, BOOST_PHOENIX_PERM_A(I)                \
144                 >                                                               \
145                 env_type;                                                       \
146             env_type env = {this, BOOST_PHOENIX_a};                             \
147                                                                                 \
148             return phoenix::eval(*this, phoenix::context(env, default_actions()));\
149         }                                                                       \
150                                                                                 \
151         template <BOOST_PHOENIX_typename_A>                                     \
152         typename result_of::actor<proto_base_expr, BOOST_PHOENIX_PERM_A(I)>::type\
153         operator()(BOOST_PHOENIX_PERM_A_a(I))                                   \
154         {                                                                       \
155             typedef                                                             \
156                 BOOST_PP_CAT(vector, BOOST_PP_INC(BOOST_PHOENIX_ITERATION))<    \
157                     const actor<Expr> *, BOOST_PHOENIX_PERM_A(I)                \
158                 >                                                               \
159                 env_type;                                                       \
160             env_type env = {this, BOOST_PHOENIX_a};                             \
161                                                                                 \
162             return phoenix::eval(*this, phoenix::context(env, default_actions()));\
163         }                                                                       \
164         /**/
165
166         template <typename This, BOOST_PHOENIX_typename_A>
167         struct result<This(BOOST_PHOENIX_A)>
168             : result<This(BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, M0, _))>
169         {};
170
171         BOOST_PP_REPEAT(BOOST_PHOENIX_PERM_SIZE, BOOST_PHOENIX_ACTOR_OPERATOR, _)
172
173 #undef BOOST_PHOENIX_ACTOR_OPERATOR
174
175 #endif
176
177 #endif
178
179 #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES