1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
///////////////////////////////////////////////////////////////////////////////
/// \file deprecated.hpp
/// Definition of the deprecated BOOST_PROTO_DEFINE_FUCTION_TEMPLATE and
/// BOOST_PROTO_DEFINE_VARARG_FUCTION_TEMPLATE macros
//
// Copyright 2008 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROTO_DETAIL_DEPRECATED_HPP_EAN_11_25_2008
#define BOOST_PROTO_DETAIL_DEPRECATED_HPP_EAN_11_25_2008
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
#include <boost/preprocessor/comparison/greater.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/tuple/to_list.hpp>
#include <boost/preprocessor/logical/and.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/seq/to_tuple.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/seq/pop_back.hpp>
#include <boost/preprocessor/seq/push_back.hpp>
#include <boost/preprocessor/seq/push_front.hpp>
#include <boost/preprocessor/list/for_each_i.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
#include <boost/proto/proto_fwd.hpp>
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_TEMPLATE_AUX_(R, DATA, I, ELEM) \
(ELEM BOOST_PP_CAT(BOOST_PP_CAT(X, DATA), BOOST_PP_CAT(_, I))) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_TEMPLATE_YES_(R, DATA, I, ELEM) \
BOOST_PP_LIST_FOR_EACH_I_R( \
R \
, BOOST_PROTO_VARARG_TEMPLATE_AUX_ \
, I \
, BOOST_PP_TUPLE_TO_LIST( \
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
, BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(ELEM)) \
) \
) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_TEMPLATE_NO_(R, DATA, I, ELEM) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_TEMPLATE_(R, DATA, I, ELEM) \
BOOST_PP_IF( \
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
, BOOST_PROTO_VARARG_TEMPLATE_YES_ \
, BOOST_PROTO_VARARG_TEMPLATE_NO_ \
)(R, DATA, I, ELEM) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_TYPE_AUX_(R, DATA, I, ELEM) \
(BOOST_PP_CAT(BOOST_PP_CAT(X, DATA), BOOST_PP_CAT(_, I))) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_TEMPLATE_PARAMS_YES_(R, DATA, I, ELEM) \
< \
BOOST_PP_SEQ_ENUM( \
BOOST_PP_LIST_FOR_EACH_I_R( \
R \
, BOOST_PROTO_VARARG_TYPE_AUX_ \
, I \
, BOOST_PP_TUPLE_TO_LIST( \
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
, BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(ELEM)) \
) \
) \
) \
> \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_TEMPLATE_PARAMS_NO_(R, DATA, I, ELEM) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_TYPE_(R, DATA, I, ELEM) \
BOOST_PP_COMMA_IF(I) \
BOOST_PP_SEQ_HEAD(ELEM) \
BOOST_PP_IF( \
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
, BOOST_PROTO_TEMPLATE_PARAMS_YES_ \
, BOOST_PROTO_TEMPLATE_PARAMS_NO_ \
)(R, DATA, I, ELEM) BOOST_PP_EXPR_IF(BOOST_PP_GREATER(I, 1), const) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_AS_EXPR_(R, DATA, I, ELEM) \
BOOST_PP_EXPR_IF( \
BOOST_PP_GREATER(I, 1) \
, (( \
BOOST_PP_SEQ_HEAD(ELEM) \
BOOST_PP_IF( \
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
, BOOST_PROTO_TEMPLATE_PARAMS_YES_ \
, BOOST_PROTO_TEMPLATE_PARAMS_NO_ \
)(R, DATA, I, ELEM)() \
)) \
) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_AS_CHILD_(Z, N, DATA) \
(BOOST_PP_CAT(DATA, N)) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_SEQ_PUSH_FRONT(SEQ, ELEM) \
BOOST_PP_SEQ_POP_BACK(BOOST_PP_SEQ_PUSH_FRONT(BOOST_PP_SEQ_PUSH_BACK(SEQ, _dummy_), ELEM)) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_AS_PARAM_(Z, N, DATA) \
(BOOST_PP_CAT(DATA, N)) \
/**/
/// INTERNAL ONLY
///
#define BOOST_PROTO_VARARG_FUN_(Z, N, DATA) \
template< \
BOOST_PP_SEQ_ENUM( \
BOOST_PP_SEQ_FOR_EACH_I( \
BOOST_PROTO_VARARG_TEMPLATE_, ~ \
, BOOST_PP_SEQ_PUSH_FRONT( \
BOOST_PROTO_SEQ_PUSH_FRONT( \
BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
, (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
) \
, BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
) \
) \
BOOST_PP_REPEAT_ ## Z(N, BOOST_PROTO_VARARG_AS_PARAM_, typename A) \
) \
> \
typename boost::proto::result_of::make_expr< \
BOOST_PP_SEQ_FOR_EACH_I( \
BOOST_PROTO_VARARG_TYPE_, ~ \
, BOOST_PP_SEQ_PUSH_FRONT( \
BOOST_PROTO_SEQ_PUSH_FRONT( \
BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
, (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
) \
, BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
) \
) \
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT) \
>::type const \
BOOST_PP_TUPLE_ELEM(4, 0, DATA)(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)) \
{ \
return boost::proto::detail::make_expr_< \
BOOST_PP_SEQ_FOR_EACH_I( \
BOOST_PROTO_VARARG_TYPE_, ~ \
, BOOST_PP_SEQ_PUSH_FRONT( \
BOOST_PROTO_SEQ_PUSH_FRONT( \
BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
, (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
) \
, BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
) \
) \
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT) \
>()( \
BOOST_PP_SEQ_ENUM( \
BOOST_PP_SEQ_FOR_EACH_I( \
BOOST_PROTO_VARARG_AS_EXPR_, ~ \
, BOOST_PP_SEQ_PUSH_FRONT( \
BOOST_PROTO_SEQ_PUSH_FRONT( \
BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
, (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
) \
, BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
) \
) \
BOOST_PP_REPEAT_ ## Z(N, BOOST_PROTO_VARARG_AS_CHILD_, a) \
) \
); \
} \
/**/
/// \code
/// BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
/// 1
/// , construct
/// , boost::proto::default_domain
/// , (boost::proto::tag::function)
/// , ((op::construct)(typename)(int))
/// )
/// \endcode
#define BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(ARGCOUNT, NAME, DOMAIN, TAG, BOUNDARGS) \
BOOST_PP_REPEAT_FROM_TO( \
ARGCOUNT \
, BOOST_PP_INC(ARGCOUNT) \
, BOOST_PROTO_VARARG_FUN_ \
, (NAME, TAG, BOUNDARGS, DOMAIN) \
)\
/**/
/// \code
/// BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
/// construct
/// , boost::proto::default_domain
/// , (boost::proto::tag::function)
/// , ((op::construct)(typename)(int))
/// )
/// \endcode
#define BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(NAME, DOMAIN, TAG, BOUNDARGS) \
BOOST_PP_REPEAT( \
BOOST_PP_SUB(BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), BOOST_PP_SEQ_SIZE(BOUNDARGS)) \
, BOOST_PROTO_VARARG_FUN_ \
, (NAME, TAG, BOUNDARGS, DOMAIN) \
) \
/**/
#endif
|