Chris@16
|
1 // Copyright Daniel Wallin 2006. Use, modification and distribution is
|
Chris@16
|
2 // subject to the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
4
|
Chris@16
|
5 #ifndef BOOST_PARAMETER_PREPROCESSOR_060206_HPP
|
Chris@16
|
6 # define BOOST_PARAMETER_PREPROCESSOR_060206_HPP
|
Chris@16
|
7
|
Chris@16
|
8 # include <boost/parameter/parameters.hpp>
|
Chris@16
|
9 # include <boost/parameter/binding.hpp>
|
Chris@16
|
10 # include <boost/parameter/match.hpp>
|
Chris@16
|
11
|
Chris@16
|
12 # include <boost/parameter/aux_/parenthesized_type.hpp>
|
Chris@16
|
13 # include <boost/parameter/aux_/cast.hpp>
|
Chris@16
|
14 # include <boost/parameter/aux_/preprocessor/flatten.hpp>
|
Chris@16
|
15
|
Chris@16
|
16 # include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
Chris@16
|
17 # include <boost/preprocessor/comparison/equal.hpp>
|
Chris@16
|
18 # include <boost/preprocessor/control/if.hpp>
|
Chris@16
|
19 # include <boost/preprocessor/control/iif.hpp>
|
Chris@16
|
20 # include <boost/preprocessor/control/expr_if.hpp>
|
Chris@16
|
21 # include <boost/preprocessor/repetition/enum_params.hpp>
|
Chris@16
|
22 # include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
Chris@16
|
23 # include <boost/preprocessor/repetition/enum_trailing.hpp>
|
Chris@16
|
24 # include <boost/preprocessor/seq/first_n.hpp>
|
Chris@16
|
25 # include <boost/preprocessor/seq/for_each_product.hpp>
|
Chris@16
|
26 # include <boost/preprocessor/seq/for_each_i.hpp>
|
Chris@16
|
27 # include <boost/preprocessor/tuple/elem.hpp>
|
Chris@16
|
28 # include <boost/preprocessor/tuple/eat.hpp>
|
Chris@16
|
29 # include <boost/preprocessor/seq/fold_left.hpp>
|
Chris@16
|
30 # include <boost/preprocessor/seq/push_back.hpp>
|
Chris@16
|
31 # include <boost/preprocessor/seq/size.hpp>
|
Chris@16
|
32 # include <boost/preprocessor/seq/enum.hpp>
|
Chris@16
|
33 # include <boost/preprocessor/seq/push_back.hpp>
|
Chris@16
|
34
|
Chris@16
|
35 # include <boost/preprocessor/detail/is_nullary.hpp>
|
Chris@16
|
36
|
Chris@16
|
37 # include <boost/mpl/always.hpp>
|
Chris@16
|
38 # include <boost/mpl/apply_wrap.hpp>
|
Chris@16
|
39
|
Chris@16
|
40 # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
41 # include <boost/type.hpp>
|
Chris@16
|
42 # endif
|
Chris@16
|
43
|
Chris@16
|
44 namespace boost { namespace parameter { namespace aux {
|
Chris@16
|
45
|
Chris@16
|
46 # if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
Chris@16
|
47
|
Chris@16
|
48 // Given Match, which is "void x" where x is an argument matching
|
Chris@16
|
49 // criterion, extract a corresponding MPL predicate.
|
Chris@16
|
50 template <class Match>
|
Chris@16
|
51 struct unwrap_predicate;
|
Chris@16
|
52
|
Chris@16
|
53 // Match anything
|
Chris@16
|
54 template <>
|
Chris@16
|
55 struct unwrap_predicate<void*>
|
Chris@16
|
56 {
|
Chris@16
|
57 typedef mpl::always<mpl::true_> type;
|
Chris@16
|
58 };
|
Chris@16
|
59
|
Chris@16
|
60 #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
|
Chris@16
|
61
|
Chris@16
|
62 typedef void* voidstar;
|
Chris@16
|
63
|
Chris@16
|
64 // A matching predicate is explicitly specified
|
Chris@16
|
65 template <class Predicate>
|
Chris@16
|
66 struct unwrap_predicate<voidstar (Predicate)>
|
Chris@16
|
67 {
|
Chris@16
|
68 typedef Predicate type;
|
Chris@16
|
69 };
|
Chris@16
|
70
|
Chris@16
|
71 #else
|
Chris@16
|
72
|
Chris@16
|
73 // A matching predicate is explicitly specified
|
Chris@16
|
74 template <class Predicate>
|
Chris@16
|
75 struct unwrap_predicate<void *(Predicate)>
|
Chris@16
|
76 {
|
Chris@16
|
77 typedef Predicate type;
|
Chris@16
|
78 };
|
Chris@16
|
79
|
Chris@16
|
80 #endif
|
Chris@16
|
81
|
Chris@16
|
82
|
Chris@16
|
83 // A type to which the argument is supposed to be convertible is
|
Chris@16
|
84 // specified
|
Chris@16
|
85 template <class Target>
|
Chris@16
|
86 struct unwrap_predicate<void (Target)>
|
Chris@16
|
87 {
|
Chris@16
|
88 typedef is_convertible<mpl::_, Target> type;
|
Chris@16
|
89 };
|
Chris@16
|
90
|
Chris@16
|
91 // Recast the ParameterSpec's nested match metafunction as a free metafunction
|
Chris@16
|
92 template <
|
Chris@16
|
93 class Parameters
|
Chris@16
|
94 , BOOST_PP_ENUM_BINARY_PARAMS(
|
Chris@16
|
95 BOOST_PARAMETER_MAX_ARITY, class A, = boost::parameter::void_ BOOST_PP_INTERCEPT
|
Chris@16
|
96 )
|
Chris@16
|
97 >
|
Chris@16
|
98 struct match
|
Chris@16
|
99 : Parameters::template match<
|
Chris@16
|
100 BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, A)
|
Chris@16
|
101 >
|
Chris@16
|
102 {};
|
Chris@16
|
103 # endif
|
Chris@16
|
104
|
Chris@16
|
105 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
Chris@16
|
106
|
Chris@16
|
107 // Function template argument deduction does many of the same things
|
Chris@16
|
108 // as type matching during partial specialization, so we call a
|
Chris@16
|
109 // function template to "store" T into the type memory addressed by
|
Chris@16
|
110 // void(*)(T).
|
Chris@16
|
111 template <class T>
|
Chris@16
|
112 msvc_store_type<T,void*(*)(void**(T))>
|
Chris@16
|
113 msvc_store_predicate_type(void*(*)(void**(T)));
|
Chris@16
|
114
|
Chris@16
|
115 template <class T>
|
Chris@16
|
116 msvc_store_type<boost::is_convertible<mpl::_,T>,void*(*)(void*(T))>
|
Chris@16
|
117 msvc_store_predicate_type(void*(*)(void*(T)));
|
Chris@16
|
118
|
Chris@16
|
119 template <class FunctionType>
|
Chris@16
|
120 struct unwrap_predicate
|
Chris@16
|
121 {
|
Chris@16
|
122 static FunctionType f;
|
Chris@16
|
123
|
Chris@16
|
124 // We don't want the function to be evaluated, just instantiated,
|
Chris@16
|
125 // so protect it inside of sizeof.
|
Chris@16
|
126 enum { dummy = sizeof(msvc_store_predicate_type(f)) };
|
Chris@16
|
127
|
Chris@16
|
128 // Now pull the type out of the instantiated base class
|
Chris@16
|
129 typedef typename msvc_type_memory<FunctionType>::storage::type type;
|
Chris@16
|
130 };
|
Chris@16
|
131
|
Chris@16
|
132 template <>
|
Chris@16
|
133 struct unwrap_predicate<void*(*)(void**)>
|
Chris@16
|
134 {
|
Chris@16
|
135 typedef mpl::always<mpl::true_> type;
|
Chris@16
|
136 };
|
Chris@16
|
137
|
Chris@16
|
138 # endif
|
Chris@16
|
139
|
Chris@16
|
140 # undef false_
|
Chris@16
|
141
|
Chris@16
|
142 template <
|
Chris@16
|
143 class Parameters
|
Chris@16
|
144 , BOOST_PP_ENUM_BINARY_PARAMS(
|
Chris@16
|
145 BOOST_PARAMETER_MAX_ARITY, class A, = boost::parameter::void_ BOOST_PP_INTERCEPT
|
Chris@16
|
146 )
|
Chris@16
|
147 >
|
Chris@16
|
148 struct argument_pack
|
Chris@16
|
149 {
|
Chris@16
|
150 typedef typename make_arg_list<
|
Chris@16
|
151 typename BOOST_PARAMETER_build_arg_list(
|
Chris@16
|
152 BOOST_PARAMETER_MAX_ARITY, make_items, typename Parameters::parameter_spec, A
|
Chris@16
|
153 )::type
|
Chris@16
|
154 , typename Parameters::deduced_list
|
Chris@16
|
155 , tag_keyword_arg
|
Chris@16
|
156 , mpl::false_
|
Chris@16
|
157 >::type result;
|
Chris@16
|
158 typedef typename mpl::first<result>::type type;
|
Chris@16
|
159 };
|
Chris@16
|
160
|
Chris@16
|
161 # if 1 //BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
Chris@16
|
162 // Works around VC6 problem where it won't accept rvalues.
|
Chris@16
|
163 template <class T>
|
Chris@16
|
164 T& as_lvalue(T& value, long)
|
Chris@16
|
165 {
|
Chris@16
|
166 return value;
|
Chris@16
|
167 }
|
Chris@16
|
168
|
Chris@16
|
169 template <class T>
|
Chris@16
|
170 T const& as_lvalue(T const& value, int)
|
Chris@16
|
171 {
|
Chris@16
|
172 return value;
|
Chris@16
|
173 }
|
Chris@16
|
174 # endif
|
Chris@16
|
175
|
Chris@16
|
176
|
Chris@16
|
177 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
Chris@16
|
178 || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
Chris@16
|
179
|
Chris@16
|
180 template <class Predicate, class T, class Args>
|
Chris@16
|
181 struct apply_predicate
|
Chris@16
|
182 {
|
Chris@16
|
183 BOOST_MPL_ASSERT((
|
Chris@16
|
184 mpl::and_<mpl::false_,T>
|
Chris@16
|
185 ));
|
Chris@16
|
186
|
Chris@16
|
187 typedef typename mpl::if_<
|
Chris@16
|
188 typename mpl::apply2<Predicate,T,Args>::type
|
Chris@16
|
189 , char
|
Chris@16
|
190 , int
|
Chris@16
|
191 >::type type;
|
Chris@16
|
192 };
|
Chris@16
|
193
|
Chris@16
|
194 template <class P>
|
Chris@16
|
195 struct funptr_predicate
|
Chris@16
|
196 {
|
Chris@16
|
197 static P p;
|
Chris@16
|
198
|
Chris@16
|
199 template <class T, class Args, class P0>
|
Chris@16
|
200 static typename apply_predicate<P0,T,Args>::type
|
Chris@16
|
201 check_predicate(type<T>, Args*, void**(*)(P0));
|
Chris@16
|
202
|
Chris@16
|
203 template <class T, class Args, class P0>
|
Chris@16
|
204 static typename mpl::if_<
|
Chris@16
|
205 is_convertible<T,P0>
|
Chris@16
|
206 , char
|
Chris@16
|
207 , int
|
Chris@16
|
208 >::type check_predicate(type<T>, Args*, void*(*)(P0));
|
Chris@16
|
209
|
Chris@16
|
210 template <class T, class Args>
|
Chris@16
|
211 struct apply
|
Chris@16
|
212 {
|
Chris@16
|
213 BOOST_STATIC_CONSTANT(bool, result =
|
Chris@16
|
214 sizeof(check_predicate(boost::type<T>(), (Args*)0, &p)) == 1
|
Chris@16
|
215 );
|
Chris@16
|
216
|
Chris@16
|
217 typedef mpl::bool_<apply<T,Args>::result> type;
|
Chris@16
|
218 };
|
Chris@16
|
219 };
|
Chris@16
|
220
|
Chris@16
|
221 template <>
|
Chris@16
|
222 struct funptr_predicate<void**>
|
Chris@16
|
223 : mpl::always<mpl::true_>
|
Chris@16
|
224 {};
|
Chris@16
|
225
|
Chris@16
|
226 # endif
|
Chris@16
|
227
|
Chris@16
|
228 }}} // namespace boost::parameter::aux
|
Chris@16
|
229
|
Chris@16
|
230 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
Chris@16
|
231 // From Paul Mensonides
|
Chris@16
|
232 # define BOOST_PARAMETER_IS_NULLARY(x) \
|
Chris@16
|
233 BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_NULLARY_C x BOOST_PP_COMMA() 0) \
|
Chris@16
|
234 /**/
|
Chris@16
|
235 # define BOOST_PARAMETER_IS_NULLARY_C() \
|
Chris@16
|
236 ~, 1 BOOST_PP_RPAREN() \
|
Chris@16
|
237 BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \
|
Chris@16
|
238 /**/
|
Chris@16
|
239 # else
|
Chris@16
|
240 # define BOOST_PARAMETER_IS_NULLARY(x) BOOST_PP_IS_NULLARY(x)
|
Chris@16
|
241 # endif
|
Chris@16
|
242
|
Chris@16
|
243 # define BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_static ()
|
Chris@16
|
244 # define BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
|
Chris@16
|
245 BOOST_PARAMETER_IS_NULLARY( \
|
Chris@16
|
246 BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_,name) \
|
Chris@16
|
247 )
|
Chris@16
|
248
|
Chris@16
|
249 # if !defined(BOOST_MSVC)
|
Chris@16
|
250 # define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static
|
Chris@16
|
251 # define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \
|
Chris@16
|
252 BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name)
|
Chris@16
|
253 # else
|
Chris@16
|
254 // Workaround for MSVC preprocessor.
|
Chris@16
|
255 //
|
Chris@16
|
256 // When stripping static from "static f", msvc will produce
|
Chris@16
|
257 // " f". The leading whitespace doesn't go away when pasting
|
Chris@16
|
258 // the token with something else, so this thing is a hack to
|
Chris@16
|
259 // strip the whitespace.
|
Chris@16
|
260 # define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static (
|
Chris@16
|
261 # define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \
|
Chris@16
|
262 BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name))
|
Chris@16
|
263 # define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \
|
Chris@16
|
264 BOOST_PP_SEQ_HEAD( \
|
Chris@16
|
265 BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \
|
Chris@16
|
266 )
|
Chris@16
|
267 # endif
|
Chris@16
|
268
|
Chris@16
|
269 # define BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
|
Chris@16
|
270 BOOST_PP_EXPR_IF( \
|
Chris@16
|
271 BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
|
Chris@16
|
272 , static \
|
Chris@16
|
273 )
|
Chris@16
|
274
|
Chris@16
|
275 # define BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name) \
|
Chris@16
|
276 BOOST_PP_IF( \
|
Chris@16
|
277 BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
|
Chris@16
|
278 , BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC \
|
Chris@16
|
279 , name BOOST_PP_TUPLE_EAT(1) \
|
Chris@16
|
280 )(name)
|
Chris@16
|
281
|
Chris@16
|
282 // Calculates [begin, end) arity range.
|
Chris@16
|
283
|
Chris@16
|
284 # define BOOST_PARAMETER_ARITY_RANGE_M_optional(state) state
|
Chris@16
|
285 # define BOOST_PARAMETER_ARITY_RANGE_M_deduced_optional(state) state
|
Chris@16
|
286 # define BOOST_PARAMETER_ARITY_RANGE_M_required(state) BOOST_PP_INC(state)
|
Chris@16
|
287 # define BOOST_PARAMETER_ARITY_RANGE_M_deduced_required(state) BOOST_PP_INC(state)
|
Chris@16
|
288
|
Chris@16
|
289 # define BOOST_PARAMETER_ARITY_RANGE_M(s, state, x) \
|
Chris@16
|
290 BOOST_PP_CAT( \
|
Chris@16
|
291 BOOST_PARAMETER_ARITY_RANGE_M_ \
|
Chris@16
|
292 , BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
|
Chris@16
|
293 )(state)
|
Chris@16
|
294 /**/
|
Chris@16
|
295
|
Chris@16
|
296 # define BOOST_PARAMETER_ARITY_RANGE(args) \
|
Chris@16
|
297 ( \
|
Chris@16
|
298 BOOST_PP_SEQ_FOLD_LEFT(BOOST_PARAMETER_ARITY_RANGE_M, 0, args) \
|
Chris@16
|
299 , BOOST_PP_INC(BOOST_PP_SEQ_SIZE(args)) \
|
Chris@16
|
300 )
|
Chris@16
|
301 /**/
|
Chris@16
|
302
|
Chris@16
|
303 // Accessor macros for the argument specs tuple.
|
Chris@16
|
304 # define BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
|
Chris@16
|
305 BOOST_PP_TUPLE_ELEM(4,0,x)
|
Chris@16
|
306 /**/
|
Chris@16
|
307
|
Chris@16
|
308 # define BOOST_PARAMETER_FN_ARG_NAME(x) \
|
Chris@16
|
309 BOOST_PP_TUPLE_ELEM(4,1,x)
|
Chris@16
|
310 /**/
|
Chris@16
|
311
|
Chris@16
|
312 # define BOOST_PARAMETER_FN_ARG_PRED(x) \
|
Chris@16
|
313 BOOST_PP_TUPLE_ELEM(4,2,x)
|
Chris@16
|
314 /**/
|
Chris@16
|
315
|
Chris@16
|
316 # define BOOST_PARAMETER_FN_ARG_DEFAULT(x) \
|
Chris@16
|
317 BOOST_PP_TUPLE_ELEM(4,3,x)
|
Chris@16
|
318 /**/
|
Chris@16
|
319
|
Chris@16
|
320 # define BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_out(x)
|
Chris@16
|
321 # define BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_in_out(x)
|
Chris@16
|
322
|
Chris@16
|
323 // Returns 1 if x is either "out(k)" or "in_out(k)".
|
Chris@16
|
324 # define BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER(x) \
|
Chris@16
|
325 BOOST_PP_IS_EMPTY( \
|
Chris@16
|
326 BOOST_PP_CAT(BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_, x) \
|
Chris@16
|
327 ) \
|
Chris@16
|
328 /**/
|
Chris@16
|
329
|
Chris@16
|
330 # define BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_out(x) x
|
Chris@16
|
331 # define BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_in_out(x) x
|
Chris@16
|
332 # define BOOST_PARAMETER_FUNCTION_KEYWORD_GET(x) \
|
Chris@16
|
333 BOOST_PP_CAT(BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_, x)
|
Chris@16
|
334 /**/
|
Chris@16
|
335
|
Chris@16
|
336 // Returns the keyword of x, where x is either a keyword qualifier
|
Chris@16
|
337 // or a keyword.
|
Chris@16
|
338 //
|
Chris@16
|
339 // k => k
|
Chris@16
|
340 // out(k) => k
|
Chris@16
|
341 // in_out(k) => k
|
Chris@16
|
342 //
|
Chris@16
|
343 # define BOOST_PARAMETER_FUNCTION_KEYWORD(x) \
|
Chris@16
|
344 BOOST_PP_IF( \
|
Chris@16
|
345 BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER(x) \
|
Chris@16
|
346 , BOOST_PARAMETER_FUNCTION_KEYWORD_GET \
|
Chris@16
|
347 , x BOOST_PP_TUPLE_EAT(1) \
|
Chris@16
|
348 )(x)
|
Chris@16
|
349 /**/
|
Chris@16
|
350
|
Chris@16
|
351 # define BOOST_PARAMETER_FN_ARG_KEYWORD(x) \
|
Chris@16
|
352 BOOST_PARAMETER_FUNCTION_KEYWORD( \
|
Chris@16
|
353 BOOST_PARAMETER_FN_ARG_NAME(x) \
|
Chris@16
|
354 )
|
Chris@16
|
355
|
Chris@16
|
356 // Builds forwarding functions.
|
Chris@16
|
357
|
Chris@16
|
358 # define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z(z, n) \
|
Chris@16
|
359 template<BOOST_PP_ENUM_PARAMS_Z(z, n, class ParameterArgumentType)>
|
Chris@16
|
360 /**/
|
Chris@16
|
361
|
Chris@16
|
362 # if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
|
Chris@16
|
363 # define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n) \
|
Chris@16
|
364 , typename boost::parameter::aux::match< \
|
Chris@16
|
365 parameters, BOOST_PP_ENUM_PARAMS(n, ParameterArgumentType) \
|
Chris@16
|
366 >::type = parameters()
|
Chris@16
|
367 # else
|
Chris@16
|
368 # define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n)
|
Chris@16
|
369 # endif
|
Chris@16
|
370 /**/
|
Chris@16
|
371
|
Chris@16
|
372 # define BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(base) \
|
Chris@16
|
373 BOOST_PP_CAT( \
|
Chris@16
|
374 boost_param_parameters_ \
|
Chris@16
|
375 , BOOST_PP_CAT(__LINE__, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base)) \
|
Chris@16
|
376 )
|
Chris@16
|
377
|
Chris@16
|
378 // Produce a name for a result type metafunction for the function
|
Chris@16
|
379 // named base
|
Chris@16
|
380 # define BOOST_PARAMETER_FUNCTION_RESULT_NAME(base) \
|
Chris@16
|
381 BOOST_PP_CAT( \
|
Chris@16
|
382 boost_param_result_ \
|
Chris@16
|
383 , BOOST_PP_CAT(__LINE__,BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base)) \
|
Chris@16
|
384 )
|
Chris@16
|
385
|
Chris@16
|
386 // Can't do boost_param_impl_ ## basee because base might start with an underscore
|
Chris@16
|
387 // daniel: what? how is that relevant? the reason for using CAT() is to make sure
|
Chris@16
|
388 // base is expanded. i'm not sure we need to here, but it's more stable to do it.
|
Chris@16
|
389 # define BOOST_PARAMETER_IMPL(base) \
|
Chris@16
|
390 BOOST_PP_CAT(boost_param_impl,BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base))
|
Chris@16
|
391
|
Chris@16
|
392 # define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00(z, n, r, data, elem) \
|
Chris@16
|
393 BOOST_PP_IF( \
|
Chris@16
|
394 n \
|
Chris@16
|
395 , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z, BOOST_PP_TUPLE_EAT(2) \
|
Chris@16
|
396 )(z,n) \
|
Chris@16
|
397 BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(7,3,data)) \
|
Chris@16
|
398 inline \
|
Chris@16
|
399 BOOST_PP_EXPR_IF(n, typename) \
|
Chris@16
|
400 BOOST_PARAMETER_FUNCTION_RESULT_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))< \
|
Chris@16
|
401 BOOST_PP_EXPR_IF(n, typename) \
|
Chris@16
|
402 boost::parameter::aux::argument_pack< \
|
Chris@16
|
403 BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data)) \
|
Chris@16
|
404 BOOST_PP_COMMA_IF(n) \
|
Chris@16
|
405 BOOST_PP_IF( \
|
Chris@16
|
406 n, BOOST_PP_SEQ_ENUM, BOOST_PP_TUPLE_EAT(1) \
|
Chris@16
|
407 )(elem) \
|
Chris@16
|
408 >::type \
|
Chris@16
|
409 >::type \
|
Chris@16
|
410 BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))( \
|
Chris@16
|
411 BOOST_PP_IF( \
|
Chris@16
|
412 n \
|
Chris@16
|
413 , BOOST_PP_SEQ_FOR_EACH_I_R \
|
Chris@16
|
414 , BOOST_PP_TUPLE_EAT(4) \
|
Chris@16
|
415 )( \
|
Chris@16
|
416 r \
|
Chris@16
|
417 , BOOST_PARAMETER_FUNCTION_ARGUMENT \
|
Chris@16
|
418 , ~ \
|
Chris@16
|
419 , elem \
|
Chris@16
|
420 ) \
|
Chris@16
|
421 BOOST_PP_IF(n, BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z, BOOST_PP_TUPLE_EAT(4))( \
|
Chris@16
|
422 z \
|
Chris@16
|
423 , BOOST_PP_TUPLE_ELEM(7,3,data) \
|
Chris@16
|
424 , BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data)) \
|
Chris@16
|
425 , n \
|
Chris@16
|
426 ) \
|
Chris@16
|
427 ) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(7,4,data), const) \
|
Chris@16
|
428 { \
|
Chris@16
|
429 return BOOST_PARAMETER_IMPL(BOOST_PP_TUPLE_ELEM(7,3,data))( \
|
Chris@16
|
430 BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))()( \
|
Chris@16
|
431 BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
|
Chris@16
|
432 ) \
|
Chris@16
|
433 ); \
|
Chris@16
|
434 }
|
Chris@16
|
435 /**/
|
Chris@16
|
436
|
Chris@16
|
437 # define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION0(r, data, elem) \
|
Chris@16
|
438 BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00( \
|
Chris@16
|
439 BOOST_PP_TUPLE_ELEM(7,0,data) \
|
Chris@16
|
440 , BOOST_PP_TUPLE_ELEM(7,1,data) \
|
Chris@16
|
441 , r \
|
Chris@16
|
442 , data \
|
Chris@16
|
443 , elem \
|
Chris@16
|
444 )
|
Chris@16
|
445 /**/
|
Chris@16
|
446
|
Chris@16
|
447 # define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_0(z, n, data) \
|
Chris@16
|
448 BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00( \
|
Chris@16
|
449 z, n, BOOST_PP_DEDUCE_R() \
|
Chris@16
|
450 , (z, n, BOOST_PP_TUPLE_REM(5) data) \
|
Chris@16
|
451 , ~ \
|
Chris@16
|
452 )
|
Chris@16
|
453 /**/
|
Chris@16
|
454
|
Chris@16
|
455 # define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_N(z, n, data) \
|
Chris@16
|
456 BOOST_PP_SEQ_FOR_EACH( \
|
Chris@16
|
457 BOOST_PARAMETER_FUNCTION_FWD_FUNCTION0 \
|
Chris@16
|
458 , (z, n, BOOST_PP_TUPLE_REM(5) data) \
|
Chris@16
|
459 , BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
|
Chris@16
|
460 BOOST_PARAMETER_FUNCTION_FWD_PRODUCT \
|
Chris@16
|
461 , BOOST_PP_SEQ_FIRST_N( \
|
Chris@16
|
462 n, BOOST_PP_TUPLE_ELEM(5,3,data) \
|
Chris@16
|
463 ) \
|
Chris@16
|
464 ) \
|
Chris@16
|
465 )
|
Chris@16
|
466 /**/
|
Chris@16
|
467
|
Chris@16
|
468 # define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION(z, n, data) \
|
Chris@16
|
469 BOOST_PP_IF( \
|
Chris@16
|
470 n \
|
Chris@16
|
471 , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_N \
|
Chris@16
|
472 , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_0 \
|
Chris@16
|
473 )(z,n,data) \
|
Chris@16
|
474 /**/
|
Chris@16
|
475
|
Chris@16
|
476 # define BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS0( \
|
Chris@16
|
477 result,name,args,const_,combinations,range \
|
Chris@16
|
478 ) \
|
Chris@16
|
479 BOOST_PP_REPEAT_FROM_TO( \
|
Chris@16
|
480 BOOST_PP_TUPLE_ELEM(2,0,range), BOOST_PP_TUPLE_ELEM(2,1,range) \
|
Chris@16
|
481 , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION \
|
Chris@16
|
482 , (result,name,const_,combinations,BOOST_PP_TUPLE_ELEM(2,1,range)) \
|
Chris@16
|
483 )
|
Chris@16
|
484 /**/
|
Chris@16
|
485
|
Chris@16
|
486 # define BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS(result,name,args, const_, combinations) \
|
Chris@16
|
487 BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS0( \
|
Chris@16
|
488 result, name, args, const_, combinations, BOOST_PARAMETER_ARITY_RANGE(args) \
|
Chris@16
|
489 )
|
Chris@16
|
490 /**/
|
Chris@16
|
491
|
Chris@16
|
492 // Builds boost::parameter::parameters<> specialization
|
Chris@16
|
493 # define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_optional(tag) \
|
Chris@16
|
494 optional<tag
|
Chris@16
|
495
|
Chris@16
|
496 # define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_required(tag) \
|
Chris@16
|
497 required<tag
|
Chris@16
|
498
|
Chris@16
|
499 # define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_deduced_optional(tag) \
|
Chris@16
|
500 optional<boost::parameter::deduced<tag>
|
Chris@16
|
501
|
Chris@16
|
502 # define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_deduced_required(tag) \
|
Chris@16
|
503 required<boost::parameter::deduced<tag>
|
Chris@16
|
504
|
Chris@16
|
505 # if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
Chris@16
|
506
|
Chris@16
|
507 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
Chris@16
|
508 # define BOOST_PARAMETER_PREDICATE_TYPE(p) void*(*) (void* p)
|
Chris@16
|
509 # else
|
Chris@16
|
510 # define BOOST_PARAMETER_PREDICATE_TYPE(p) void p
|
Chris@16
|
511 # endif
|
Chris@16
|
512
|
Chris@16
|
513 # define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
|
Chris@16
|
514 BOOST_PP_COMMA_IF(i) \
|
Chris@16
|
515 boost::parameter::BOOST_PP_CAT( \
|
Chris@16
|
516 BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
|
Chris@16
|
517 , BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
|
Chris@16
|
518 )( \
|
Chris@16
|
519 tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
|
Chris@16
|
520 BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
|
Chris@16
|
521 ) \
|
Chris@16
|
522 ) \
|
Chris@16
|
523 , typename boost::parameter::aux::unwrap_predicate< \
|
Chris@16
|
524 BOOST_PARAMETER_PREDICATE_TYPE(BOOST_PARAMETER_FN_ARG_PRED(elem)) \
|
Chris@16
|
525 >::type \
|
Chris@16
|
526 >
|
Chris@16
|
527 # elif BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
Chris@16
|
528 # define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
|
Chris@16
|
529 BOOST_PP_COMMA_IF(i) \
|
Chris@16
|
530 boost::parameter::BOOST_PP_CAT( \
|
Chris@16
|
531 BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
|
Chris@16
|
532 , BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
|
Chris@16
|
533 )( \
|
Chris@16
|
534 tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
|
Chris@16
|
535 BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
|
Chris@16
|
536 ) \
|
Chris@16
|
537 ) \
|
Chris@16
|
538 , boost::parameter::aux::funptr_predicate< \
|
Chris@16
|
539 void* BOOST_PARAMETER_FN_ARG_PRED(elem) \
|
Chris@16
|
540 > \
|
Chris@16
|
541 >
|
Chris@16
|
542 # elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
Chris@16
|
543 # define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
|
Chris@16
|
544 BOOST_PP_COMMA_IF(i) \
|
Chris@16
|
545 boost::parameter::BOOST_PP_CAT( \
|
Chris@16
|
546 BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
|
Chris@16
|
547 , BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
|
Chris@16
|
548 )( \
|
Chris@16
|
549 tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
|
Chris@16
|
550 BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
|
Chris@16
|
551 ) \
|
Chris@16
|
552 ) \
|
Chris@16
|
553 , boost::mpl::always<boost::mpl::true_> \
|
Chris@16
|
554 >
|
Chris@16
|
555 # endif
|
Chris@16
|
556
|
Chris@16
|
557 # define BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, base, args) \
|
Chris@16
|
558 template <class BoostParameterDummy> \
|
Chris@16
|
559 struct BOOST_PP_CAT( \
|
Chris@16
|
560 BOOST_PP_CAT(boost_param_params_, __LINE__) \
|
Chris@16
|
561 , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
|
Chris@16
|
562 ) : boost::parameter::parameters< \
|
Chris@16
|
563 BOOST_PP_SEQ_FOR_EACH_I( \
|
Chris@16
|
564 BOOST_PARAMETER_FUNCTION_PARAMETERS_M, tag_namespace, args \
|
Chris@16
|
565 ) \
|
Chris@16
|
566 > \
|
Chris@16
|
567 {}; \
|
Chris@16
|
568 \
|
Chris@16
|
569 typedef BOOST_PP_CAT( \
|
Chris@16
|
570 BOOST_PP_CAT(boost_param_params_, __LINE__) \
|
Chris@16
|
571 , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
|
Chris@16
|
572 )<int>
|
Chris@16
|
573
|
Chris@16
|
574 // Defines result type metafunction
|
Chris@16
|
575 # define BOOST_PARAMETER_FUNCTION_RESULT_ARG(z, _, i, x) \
|
Chris@16
|
576 BOOST_PP_COMMA_IF(i) class BOOST_PP_TUPLE_ELEM(3,1,x)
|
Chris@16
|
577 /**/
|
Chris@16
|
578
|
Chris@16
|
579 # define BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args) \
|
Chris@16
|
580 template <class Args> \
|
Chris@16
|
581 struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name) \
|
Chris@16
|
582 { \
|
Chris@16
|
583 typedef typename BOOST_PARAMETER_PARENTHESIZED_TYPE(result) type; \
|
Chris@16
|
584 };
|
Chris@16
|
585
|
Chris@16
|
586 # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
587
|
Chris@16
|
588 # define BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
|
Chris@16
|
589 BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args) \
|
Chris@16
|
590 template <> \
|
Chris@16
|
591 struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<int> \
|
Chris@16
|
592 { typedef int type; };
|
Chris@16
|
593
|
Chris@16
|
594 # else
|
Chris@16
|
595
|
Chris@16
|
596 # define BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
|
Chris@16
|
597 BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args)
|
Chris@16
|
598
|
Chris@16
|
599 # endif
|
Chris@16
|
600
|
Chris@16
|
601 // Defines implementation function
|
Chris@16
|
602 # define BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name) \
|
Chris@16
|
603 template <class Args> \
|
Chris@16
|
604 typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)< \
|
Chris@16
|
605 Args \
|
Chris@16
|
606 >::type BOOST_PARAMETER_IMPL(name)(Args const& args)
|
Chris@16
|
607
|
Chris@16
|
608 # define BOOST_PARAMETER_FUNCTION_IMPL_FWD(name) \
|
Chris@16
|
609 BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name);
|
Chris@16
|
610 /**/
|
Chris@16
|
611
|
Chris@16
|
612 # define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(state, arg) \
|
Chris@16
|
613 ( \
|
Chris@16
|
614 BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 0, state)) \
|
Chris@16
|
615 , BOOST_PP_SEQ_PUSH_BACK(BOOST_PP_TUPLE_ELEM(4, 1, state), arg) \
|
Chris@16
|
616 , BOOST_PP_TUPLE_ELEM(4, 2, state) \
|
Chris@16
|
617 , BOOST_PP_TUPLE_ELEM(4, 3, state) \
|
Chris@16
|
618 )
|
Chris@16
|
619
|
Chris@16
|
620 # define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_required(state, arg) \
|
Chris@16
|
621 BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(state, arg)
|
Chris@16
|
622
|
Chris@16
|
623 # define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(state, arg) \
|
Chris@16
|
624 ( \
|
Chris@16
|
625 BOOST_PP_TUPLE_ELEM(4, 0, state) \
|
Chris@16
|
626 , BOOST_PP_TUPLE_ELEM(4, 1, state) \
|
Chris@16
|
627 , BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 2, state)) \
|
Chris@16
|
628 , BOOST_PP_SEQ_PUSH_BACK(BOOST_PP_TUPLE_ELEM(4, 3, state), arg) \
|
Chris@16
|
629 )
|
Chris@16
|
630
|
Chris@16
|
631 # define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_optional(state, arg) \
|
Chris@16
|
632 BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(state, arg)
|
Chris@16
|
633
|
Chris@16
|
634 # define BOOST_PARAMETER_FUNCTION_SPLIT_ARG(s, state, arg) \
|
Chris@16
|
635 BOOST_PP_CAT( \
|
Chris@16
|
636 BOOST_PARAMETER_FUNCTION_SPLIT_ARG_ \
|
Chris@16
|
637 , BOOST_PARAMETER_FN_ARG_QUALIFIER(arg) \
|
Chris@16
|
638 )(state, arg)
|
Chris@16
|
639
|
Chris@16
|
640 // Returns (required_count, required, optional_count, optionals) tuple
|
Chris@16
|
641 # define BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args) \
|
Chris@16
|
642 BOOST_PP_SEQ_FOLD_LEFT( \
|
Chris@16
|
643 BOOST_PARAMETER_FUNCTION_SPLIT_ARG \
|
Chris@16
|
644 , (0,BOOST_PP_SEQ_NIL, 0,BOOST_PP_SEQ_NIL) \
|
Chris@16
|
645 , args \
|
Chris@16
|
646 )
|
Chris@16
|
647
|
Chris@16
|
648 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME(keyword) \
|
Chris@16
|
649 BOOST_PP_CAT(BOOST_PP_CAT(keyword,_),type)
|
Chris@16
|
650
|
Chris@16
|
651 // Helpers used as parameters to BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS.
|
Chris@16
|
652 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG(r, _, arg) \
|
Chris@16
|
653 , class BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME( \
|
Chris@16
|
654 BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
|
Chris@16
|
655 )
|
Chris@16
|
656
|
Chris@16
|
657 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG(r, _, arg) \
|
Chris@16
|
658 , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME( \
|
Chris@16
|
659 BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
|
Chris@16
|
660 )& BOOST_PARAMETER_FN_ARG_KEYWORD(arg)
|
Chris@16
|
661
|
Chris@16
|
662 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER(r, _, arg) \
|
Chris@16
|
663 , BOOST_PARAMETER_FN_ARG_KEYWORD(arg)
|
Chris@16
|
664
|
Chris@16
|
665 // Produces a name for the dispatch functions.
|
Chris@16
|
666 # define BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name) \
|
Chris@16
|
667 BOOST_PP_CAT( \
|
Chris@16
|
668 boost_param_default_ \
|
Chris@16
|
669 , BOOST_PP_CAT(__LINE__, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name)) \
|
Chris@16
|
670 )
|
Chris@16
|
671
|
Chris@16
|
672 // Helper macro used below to produce lists based on the keyword argument
|
Chris@16
|
673 // names. macro is applied to every element. n is the number of
|
Chris@16
|
674 // optional arguments that should be included.
|
Chris@16
|
675 # define BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS(macro, n, split_args) \
|
Chris@16
|
676 BOOST_PP_SEQ_FOR_EACH( \
|
Chris@16
|
677 macro \
|
Chris@16
|
678 , ~ \
|
Chris@16
|
679 , BOOST_PP_TUPLE_ELEM(4,1,split_args) \
|
Chris@16
|
680 ) \
|
Chris@16
|
681 BOOST_PP_SEQ_FOR_EACH( \
|
Chris@16
|
682 macro \
|
Chris@16
|
683 , ~ \
|
Chris@16
|
684 , BOOST_PP_SEQ_FIRST_N( \
|
Chris@16
|
685 BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), n) \
|
Chris@16
|
686 , BOOST_PP_TUPLE_ELEM(4,3,split_args) \
|
Chris@16
|
687 ) \
|
Chris@16
|
688 )
|
Chris@16
|
689
|
Chris@16
|
690 // Generates a keyword | default expression.
|
Chris@16
|
691 # define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT(arg, tag_namespace) \
|
Chris@16
|
692 boost::parameter::keyword< \
|
Chris@16
|
693 tag_namespace::BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
|
Chris@16
|
694 >::instance | boost::parameter::aux::use_default_tag()
|
Chris@16
|
695
|
Chris@16
|
696 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_GET_ARG(arg, tag_ns) \
|
Chris@16
|
697 BOOST_PARAMETER_FUNCTION_CAST( \
|
Chris@16
|
698 args[ \
|
Chris@16
|
699 BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT( \
|
Chris@16
|
700 arg, tag_ns \
|
Chris@16
|
701 ) \
|
Chris@16
|
702 ] \
|
Chris@16
|
703 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
|
Chris@16
|
704 , Args \
|
Chris@16
|
705 )
|
Chris@16
|
706
|
Chris@16
|
707 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY(name, n, split_args, tag_namespace) \
|
Chris@16
|
708 { \
|
Chris@16
|
709 return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
|
Chris@16
|
710 (ResultType(*)())0 \
|
Chris@16
|
711 , args \
|
Chris@16
|
712 , 0L \
|
Chris@16
|
713 BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
|
Chris@16
|
714 BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER \
|
Chris@16
|
715 , n \
|
Chris@16
|
716 , split_args \
|
Chris@16
|
717 ) \
|
Chris@16
|
718 , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_GET_ARG( \
|
Chris@16
|
719 BOOST_PP_SEQ_ELEM( \
|
Chris@16
|
720 BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), n) \
|
Chris@16
|
721 , BOOST_PP_TUPLE_ELEM(4,3,split_args) \
|
Chris@16
|
722 ) \
|
Chris@16
|
723 , tag_namespace \
|
Chris@16
|
724 ) \
|
Chris@16
|
725 ); \
|
Chris@16
|
726 }
|
Chris@16
|
727
|
Chris@16
|
728 # define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_ACTUAL_DEFAULT(arg) \
|
Chris@16
|
729 BOOST_PARAMETER_FUNCTION_CAST( \
|
Chris@16
|
730 boost::parameter::aux::as_lvalue(BOOST_PARAMETER_FN_ARG_DEFAULT(arg), 0L) \
|
Chris@16
|
731 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
|
Chris@16
|
732 , Args \
|
Chris@16
|
733 )
|
Chris@16
|
734
|
Chris@16
|
735 # define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY(name, n, split_args, tag_ns, const_) \
|
Chris@16
|
736 template < \
|
Chris@16
|
737 class ResultType \
|
Chris@16
|
738 , class Args \
|
Chris@16
|
739 BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
|
Chris@16
|
740 BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
|
Chris@16
|
741 , BOOST_PP_INC(n) \
|
Chris@16
|
742 , split_args \
|
Chris@16
|
743 ) \
|
Chris@16
|
744 > \
|
Chris@16
|
745 BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
|
Chris@16
|
746 ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
|
Chris@16
|
747 ResultType(*)() \
|
Chris@16
|
748 , Args const& args \
|
Chris@16
|
749 , long \
|
Chris@16
|
750 BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
|
Chris@16
|
751 BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
|
Chris@16
|
752 , BOOST_PP_INC(n) \
|
Chris@16
|
753 , split_args \
|
Chris@16
|
754 ) \
|
Chris@16
|
755 , boost::parameter::aux::use_default_tag \
|
Chris@16
|
756 ) BOOST_PP_EXPR_IF(const_, const) \
|
Chris@16
|
757 { \
|
Chris@16
|
758 return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
|
Chris@16
|
759 (ResultType(*)())0 \
|
Chris@16
|
760 , args \
|
Chris@16
|
761 , 0L \
|
Chris@16
|
762 BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
|
Chris@16
|
763 BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER \
|
Chris@16
|
764 , BOOST_PP_INC(n) \
|
Chris@16
|
765 , split_args \
|
Chris@16
|
766 ) \
|
Chris@16
|
767 , BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_ACTUAL_DEFAULT( \
|
Chris@16
|
768 BOOST_PP_SEQ_ELEM( \
|
Chris@16
|
769 BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), BOOST_PP_INC(n)) \
|
Chris@16
|
770 , BOOST_PP_TUPLE_ELEM(4,3,split_args) \
|
Chris@16
|
771 ) \
|
Chris@16
|
772 ) \
|
Chris@16
|
773 ); \
|
Chris@16
|
774 }
|
Chris@16
|
775
|
Chris@16
|
776 // Produces a forwarding layer in the default evaluation machine.
|
Chris@16
|
777 //
|
Chris@16
|
778 // data is a tuple:
|
Chris@16
|
779 //
|
Chris@16
|
780 // (name, split_args)
|
Chris@16
|
781 //
|
Chris@16
|
782 // Where name is the base name of the function, and split_args is a tuple:
|
Chris@16
|
783 //
|
Chris@16
|
784 // (required_count, required_args, optional_count, required_args)
|
Chris@16
|
785 //
|
Chris@16
|
786
|
Chris@16
|
787
|
Chris@16
|
788 // defines the actual function body for BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION below.
|
Chris@16
|
789 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION0(z, n, data) \
|
Chris@16
|
790 template < \
|
Chris@16
|
791 class ResultType \
|
Chris@16
|
792 , class Args \
|
Chris@16
|
793 BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
|
Chris@16
|
794 BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
|
Chris@16
|
795 , n \
|
Chris@16
|
796 , BOOST_PP_TUPLE_ELEM(5,1,data) \
|
Chris@16
|
797 ) \
|
Chris@16
|
798 > \
|
Chris@16
|
799 BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(5,0,data)) \
|
Chris@16
|
800 ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(BOOST_PP_TUPLE_ELEM(5,0,data))( \
|
Chris@16
|
801 ResultType(*)() \
|
Chris@16
|
802 , Args const& args \
|
Chris@16
|
803 , int \
|
Chris@16
|
804 BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
|
Chris@16
|
805 BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
|
Chris@16
|
806 , n \
|
Chris@16
|
807 , BOOST_PP_TUPLE_ELEM(5,1,data) \
|
Chris@16
|
808 ) \
|
Chris@16
|
809 ) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(5,2,data), const) \
|
Chris@16
|
810 BOOST_PP_IF( \
|
Chris@16
|
811 n \
|
Chris@16
|
812 , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY \
|
Chris@16
|
813 , ; BOOST_PP_TUPLE_EAT(4) \
|
Chris@16
|
814 )( \
|
Chris@16
|
815 BOOST_PP_TUPLE_ELEM(5,0,data) \
|
Chris@16
|
816 , n \
|
Chris@16
|
817 , BOOST_PP_TUPLE_ELEM(5,1,data) \
|
Chris@16
|
818 , BOOST_PP_TUPLE_ELEM(5,3,data) \
|
Chris@16
|
819 )
|
Chris@16
|
820
|
Chris@16
|
821 # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION(z, n, data) \
|
Chris@16
|
822 BOOST_PP_IF( \
|
Chris@16
|
823 BOOST_PP_AND( \
|
Chris@16
|
824 BOOST_PP_NOT(n) \
|
Chris@16
|
825 , BOOST_PP_TUPLE_ELEM(5,4,data) \
|
Chris@16
|
826 ) \
|
Chris@16
|
827 , BOOST_PP_TUPLE_EAT(3) \
|
Chris@16
|
828 , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION0 \
|
Chris@16
|
829 )(z, n, data) \
|
Chris@16
|
830 BOOST_PP_IF( \
|
Chris@16
|
831 BOOST_PP_EQUAL(n, BOOST_PP_TUPLE_ELEM(4,2,BOOST_PP_TUPLE_ELEM(5,1,data))) \
|
Chris@16
|
832 , BOOST_PP_TUPLE_EAT(5) \
|
Chris@16
|
833 , BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY \
|
Chris@16
|
834 )( \
|
Chris@16
|
835 BOOST_PP_TUPLE_ELEM(5,0,data) \
|
Chris@16
|
836 , n \
|
Chris@16
|
837 , BOOST_PP_TUPLE_ELEM(5,1,data) \
|
Chris@16
|
838 , BOOST_PP_TUPLE_ELEM(5,3,data) \
|
Chris@16
|
839 , BOOST_PP_TUPLE_ELEM(5,2,data) \
|
Chris@16
|
840 )
|
Chris@16
|
841
|
Chris@16
|
842 # define BOOST_PARAMETER_FUNCTION_DEFAULT_GET_ARG(r, tag_ns, arg) \
|
Chris@16
|
843 , BOOST_PARAMETER_FUNCTION_CAST( \
|
Chris@16
|
844 args[ \
|
Chris@16
|
845 boost::parameter::keyword<tag_ns::BOOST_PARAMETER_FN_ARG_KEYWORD(arg)>::instance \
|
Chris@16
|
846 ] \
|
Chris@16
|
847 , BOOST_PARAMETER_FN_ARG_PRED(arg) \
|
Chris@16
|
848 , Args \
|
Chris@16
|
849 )
|
Chris@16
|
850
|
Chris@16
|
851 // Generates the function template that recives a ArgumentPack, and then
|
Chris@16
|
852 // goes on to call the layers of overloads generated by
|
Chris@16
|
853 // BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER.
|
Chris@16
|
854 # define BOOST_PARAMETER_FUNCTION_INITIAL_DISPATCH_FUNCTION(name, split_args, const_, tag_ns) \
|
Chris@16
|
855 template <class Args> \
|
Chris@16
|
856 typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<Args>::type \
|
Chris@16
|
857 BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
|
Chris@16
|
858 BOOST_PARAMETER_IMPL(name)(Args const& args) BOOST_PP_EXPR_IF(const_, const) \
|
Chris@16
|
859 { \
|
Chris@16
|
860 return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
|
Chris@16
|
861 (typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<Args>::type(*)())0 \
|
Chris@16
|
862 , args \
|
Chris@16
|
863 , 0L \
|
Chris@16
|
864 \
|
Chris@16
|
865 BOOST_PP_SEQ_FOR_EACH( \
|
Chris@16
|
866 BOOST_PARAMETER_FUNCTION_DEFAULT_GET_ARG \
|
Chris@16
|
867 , tag_ns \
|
Chris@16
|
868 , BOOST_PP_TUPLE_ELEM(4,1,split_args) \
|
Chris@16
|
869 ) \
|
Chris@16
|
870 \
|
Chris@16
|
871 ); \
|
Chris@16
|
872 }
|
Chris@16
|
873
|
Chris@16
|
874 // Helper for BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER below.
|
Chris@16
|
875 # define BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER_AUX( \
|
Chris@16
|
876 name, split_args, skip_fwd_decl, const_, tag_namespace \
|
Chris@16
|
877 ) \
|
Chris@16
|
878 BOOST_PP_REPEAT_FROM_TO( \
|
Chris@16
|
879 0 \
|
Chris@16
|
880 , BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 2, split_args)) \
|
Chris@16
|
881 , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION \
|
Chris@16
|
882 , (name, split_args, const_, tag_namespace, skip_fwd_decl) \
|
Chris@16
|
883 ) \
|
Chris@16
|
884 \
|
Chris@16
|
885 BOOST_PARAMETER_FUNCTION_INITIAL_DISPATCH_FUNCTION(name, split_args, const_, tag_namespace) \
|
Chris@16
|
886 \
|
Chris@16
|
887 template < \
|
Chris@16
|
888 class ResultType \
|
Chris@16
|
889 , class Args \
|
Chris@16
|
890 BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
|
Chris@16
|
891 BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
|
Chris@16
|
892 , 0 \
|
Chris@16
|
893 , split_args \
|
Chris@16
|
894 ) \
|
Chris@16
|
895 > \
|
Chris@16
|
896 BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
|
Chris@16
|
897 ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
|
Chris@16
|
898 ResultType(*)() \
|
Chris@16
|
899 , Args const& args \
|
Chris@16
|
900 , int \
|
Chris@16
|
901 BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
|
Chris@16
|
902 BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
|
Chris@16
|
903 , 0 \
|
Chris@16
|
904 , split_args \
|
Chris@16
|
905 ) \
|
Chris@16
|
906 ) BOOST_PP_EXPR_IF(const_, const)
|
Chris@16
|
907
|
Chris@16
|
908 // Generates a bunch of forwarding functions that each extract
|
Chris@16
|
909 // one more argument.
|
Chris@16
|
910 # define BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, skip_fwd_decl, const_, tag_ns) \
|
Chris@16
|
911 BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER_AUX( \
|
Chris@16
|
912 name, BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args), skip_fwd_decl, const_, tag_ns \
|
Chris@16
|
913 )
|
Chris@16
|
914 /**/
|
Chris@16
|
915
|
Chris@16
|
916 // Defines the result metafunction and the parameters specialization.
|
Chris@16
|
917 # define BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
|
Chris@16
|
918 BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
|
Chris@16
|
919 \
|
Chris@16
|
920 BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, name, args) \
|
Chris@16
|
921 BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(name); \
|
Chris@16
|
922
|
Chris@16
|
923 // Helper for BOOST_PARAMETER_FUNCTION below.
|
Chris@16
|
924 # define BOOST_PARAMETER_FUNCTION_AUX(result, name, tag_namespace, args) \
|
Chris@16
|
925 BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
|
Chris@16
|
926 BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name); \
|
Chris@16
|
927 \
|
Chris@16
|
928 BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
|
Chris@16
|
929 result, name, args, 0 \
|
Chris@16
|
930 , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
|
Chris@16
|
931 ) \
|
Chris@16
|
932 \
|
Chris@16
|
933 BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, 0, 0, tag_namespace)
|
Chris@16
|
934
|
Chris@16
|
935 // Defines a Boost.Parameter enabled function with the new syntax.
|
Chris@16
|
936 # define BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, args) \
|
Chris@16
|
937 BOOST_PARAMETER_FUNCTION_AUX( \
|
Chris@16
|
938 result, name, tag_namespace \
|
Chris@16
|
939 , BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
|
Chris@16
|
940 ) \
|
Chris@16
|
941 /**/
|
Chris@16
|
942
|
Chris@16
|
943 // Defines a Boost.Parameter enabled function.
|
Chris@16
|
944 # define BOOST_PARAMETER_BASIC_FUNCTION_AUX(result, name, tag_namespace, args) \
|
Chris@16
|
945 BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
|
Chris@16
|
946 \
|
Chris@16
|
947 BOOST_PARAMETER_FUNCTION_IMPL_FWD(name) \
|
Chris@16
|
948 \
|
Chris@16
|
949 BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
|
Chris@16
|
950 result, name, args, 0 \
|
Chris@16
|
951 , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
|
Chris@16
|
952 ) \
|
Chris@16
|
953 \
|
Chris@16
|
954 BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name)
|
Chris@16
|
955
|
Chris@16
|
956 # define BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, args) \
|
Chris@16
|
957 BOOST_PARAMETER_BASIC_FUNCTION_AUX( \
|
Chris@16
|
958 result, name, tag_namespace \
|
Chris@16
|
959 , BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
|
Chris@16
|
960 ) \
|
Chris@16
|
961 /**/
|
Chris@16
|
962
|
Chris@16
|
963 // Defines a Boost.Parameter enabled member function.
|
Chris@16
|
964 # define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX(result, name, tag_namespace, args, const_) \
|
Chris@16
|
965 BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
|
Chris@16
|
966 \
|
Chris@16
|
967 BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
|
Chris@16
|
968 result, name, args, const_ \
|
Chris@16
|
969 , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
|
Chris@16
|
970 ) \
|
Chris@16
|
971 \
|
Chris@16
|
972 BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name) BOOST_PP_EXPR_IF(const_, const) \
|
Chris@16
|
973 /**/
|
Chris@16
|
974
|
Chris@16
|
975 # define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_namespace, args) \
|
Chris@16
|
976 BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
|
Chris@16
|
977 result, name, tag_namespace \
|
Chris@16
|
978 , BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
|
Chris@16
|
979 , 0 \
|
Chris@16
|
980 )
|
Chris@16
|
981 /**/
|
Chris@16
|
982
|
Chris@16
|
983 # define BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_namespace, args) \
|
Chris@16
|
984 BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
|
Chris@16
|
985 result, name, tag_namespace \
|
Chris@16
|
986 , BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
|
Chris@16
|
987 , 1 \
|
Chris@16
|
988 )
|
Chris@16
|
989 /**/
|
Chris@16
|
990
|
Chris@16
|
991
|
Chris@16
|
992
|
Chris@16
|
993 # define BOOST_PARAMETER_MEMBER_FUNCTION_AUX(result, name, tag_namespace, const_, args) \
|
Chris@16
|
994 BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
|
Chris@16
|
995 \
|
Chris@16
|
996 BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
|
Chris@16
|
997 result, name, args, const_ \
|
Chris@16
|
998 , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
|
Chris@16
|
999 ) \
|
Chris@16
|
1000 \
|
Chris@16
|
1001 BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, 1, const_, tag_namespace)
|
Chris@16
|
1002
|
Chris@16
|
1003 // Defines a Boost.Parameter enabled function with the new syntax.
|
Chris@16
|
1004 # define BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, args) \
|
Chris@16
|
1005 BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
|
Chris@16
|
1006 result, name, tag_namespace, 0 \
|
Chris@16
|
1007 , BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
|
Chris@16
|
1008 ) \
|
Chris@16
|
1009 /**/
|
Chris@16
|
1010
|
Chris@16
|
1011 # define BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_namespace, args) \
|
Chris@16
|
1012 BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
|
Chris@16
|
1013 result, name, tag_namespace, 1 \
|
Chris@16
|
1014 , BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
|
Chris@16
|
1015 ) \
|
Chris@16
|
1016 /**/
|
Chris@16
|
1017
|
Chris@16
|
1018 // Defines a Boost.Parameter enabled constructor.
|
Chris@16
|
1019
|
Chris@16
|
1020 # define BOOST_PARAMETER_FUNCTION_ARGUMENT(r, _, i, elem) \
|
Chris@16
|
1021 BOOST_PP_COMMA_IF(i) elem& BOOST_PP_CAT(a, i)
|
Chris@16
|
1022 /**/
|
Chris@16
|
1023
|
Chris@16
|
1024 # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
1025
|
Chris@16
|
1026 // Older MSVC can't do what's necessary to handle commas in base names; just
|
Chris@16
|
1027 // use a typedef instead if you have a base name that contains commas.
|
Chris@16
|
1028 # define BOOST_PARAMETER_PARENTHESIZED_BASE(x) BOOST_PP_SEQ_HEAD(x)
|
Chris@16
|
1029
|
Chris@16
|
1030 # else
|
Chris@16
|
1031
|
Chris@16
|
1032 # define BOOST_PARAMETER_PARENTHESIZED_BASE(x) BOOST_PARAMETER_PARENTHESIZED_TYPE(x)
|
Chris@16
|
1033
|
Chris@16
|
1034 # endif
|
Chris@16
|
1035
|
Chris@16
|
1036 # define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00(z, n, r, data, elem) \
|
Chris@16
|
1037 BOOST_PP_IF( \
|
Chris@16
|
1038 n \
|
Chris@16
|
1039 , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z, BOOST_PP_TUPLE_EAT(2) \
|
Chris@16
|
1040 )(z, n) \
|
Chris@16
|
1041 BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n,1), explicit) \
|
Chris@16
|
1042 BOOST_PP_TUPLE_ELEM(6,2,data)( \
|
Chris@16
|
1043 BOOST_PP_IF( \
|
Chris@16
|
1044 n \
|
Chris@16
|
1045 , BOOST_PP_SEQ_FOR_EACH_I_R \
|
Chris@16
|
1046 , BOOST_PP_TUPLE_EAT(4) \
|
Chris@16
|
1047 )( \
|
Chris@16
|
1048 r \
|
Chris@16
|
1049 , BOOST_PARAMETER_FUNCTION_ARGUMENT \
|
Chris@16
|
1050 , ~ \
|
Chris@16
|
1051 , elem \
|
Chris@16
|
1052 ) \
|
Chris@16
|
1053 BOOST_PP_IF(n, BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z, BOOST_PP_TUPLE_EAT(4))( \
|
Chris@16
|
1054 z \
|
Chris@16
|
1055 , BOOST_PP_TUPLE_ELEM(6,3,data) \
|
Chris@16
|
1056 , BOOST_PP_CAT(constructor_parameters, __LINE__) \
|
Chris@16
|
1057 , n \
|
Chris@16
|
1058 ) \
|
Chris@16
|
1059 ) \
|
Chris@16
|
1060 : BOOST_PARAMETER_PARENTHESIZED_BASE(BOOST_PP_TUPLE_ELEM(6,3,data)) ( \
|
Chris@16
|
1061 BOOST_PP_CAT(constructor_parameters, __LINE__)()( \
|
Chris@16
|
1062 BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
|
Chris@16
|
1063 ) \
|
Chris@16
|
1064 ) \
|
Chris@16
|
1065 {}
|
Chris@16
|
1066 /**/
|
Chris@16
|
1067
|
Chris@16
|
1068 # define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR0(r, data, elem) \
|
Chris@16
|
1069 BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00( \
|
Chris@16
|
1070 BOOST_PP_TUPLE_ELEM(6,0,data) \
|
Chris@16
|
1071 , BOOST_PP_TUPLE_ELEM(6,1,data) \
|
Chris@16
|
1072 , r \
|
Chris@16
|
1073 , data \
|
Chris@16
|
1074 , elem \
|
Chris@16
|
1075 )
|
Chris@16
|
1076 /**/
|
Chris@16
|
1077
|
Chris@16
|
1078 # define BOOST_PARAMETER_FUNCTION_FWD_PRODUCT(r, product) \
|
Chris@16
|
1079 (product)
|
Chris@16
|
1080 /**/
|
Chris@16
|
1081
|
Chris@16
|
1082 # define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_0(z, n, data) \
|
Chris@16
|
1083 BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00( \
|
Chris@16
|
1084 z, n, BOOST_PP_DEDUCE_R() \
|
Chris@16
|
1085 , (z, n, BOOST_PP_TUPLE_REM(4) data) \
|
Chris@16
|
1086 , ~ \
|
Chris@16
|
1087 )
|
Chris@16
|
1088 /**/
|
Chris@16
|
1089
|
Chris@16
|
1090 # define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_N(z, n, data) \
|
Chris@16
|
1091 BOOST_PP_SEQ_FOR_EACH( \
|
Chris@16
|
1092 BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR0 \
|
Chris@16
|
1093 , (z, n, BOOST_PP_TUPLE_REM(4) data) \
|
Chris@16
|
1094 , BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
|
Chris@16
|
1095 BOOST_PARAMETER_FUNCTION_FWD_PRODUCT \
|
Chris@16
|
1096 , BOOST_PP_SEQ_FIRST_N( \
|
Chris@16
|
1097 n, BOOST_PP_TUPLE_ELEM(4,2,data) \
|
Chris@16
|
1098 ) \
|
Chris@16
|
1099 ) \
|
Chris@16
|
1100 )
|
Chris@16
|
1101 /**/
|
Chris@16
|
1102
|
Chris@16
|
1103 # define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR(z, n, data) \
|
Chris@16
|
1104 BOOST_PP_IF( \
|
Chris@16
|
1105 n \
|
Chris@16
|
1106 , BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_N \
|
Chris@16
|
1107 , BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_0 \
|
Chris@16
|
1108 )(z,n,data) \
|
Chris@16
|
1109 /**/
|
Chris@16
|
1110
|
Chris@16
|
1111 # define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS0(class_,base,args,combinations,range) \
|
Chris@16
|
1112 BOOST_PP_REPEAT_FROM_TO( \
|
Chris@16
|
1113 BOOST_PP_TUPLE_ELEM(2,0,range), BOOST_PP_TUPLE_ELEM(2,1,range) \
|
Chris@16
|
1114 , BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR \
|
Chris@16
|
1115 , (class_,base,combinations,BOOST_PP_TUPLE_ELEM(2,1,range)) \
|
Chris@16
|
1116 )
|
Chris@16
|
1117 /**/
|
Chris@16
|
1118
|
Chris@16
|
1119 # define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS(class_,base,args,combinations) \
|
Chris@16
|
1120 BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS0( \
|
Chris@16
|
1121 class_, base, args, combinations, BOOST_PARAMETER_ARITY_RANGE(args) \
|
Chris@16
|
1122 )
|
Chris@16
|
1123 /**/
|
Chris@16
|
1124
|
Chris@16
|
1125 # define BOOST_PARAMETER_CONSTRUCTOR_AUX(class_, base, tag_namespace, args) \
|
Chris@16
|
1126 BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, ctor, args) \
|
Chris@16
|
1127 BOOST_PP_CAT(constructor_parameters, __LINE__); \
|
Chris@16
|
1128 \
|
Chris@16
|
1129 BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS( \
|
Chris@16
|
1130 class_, base, args \
|
Chris@16
|
1131 , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
|
Chris@16
|
1132 ) \
|
Chris@16
|
1133 /**/
|
Chris@16
|
1134
|
Chris@16
|
1135 # define BOOST_PARAMETER_CONSTRUCTOR(class_, base, tag_namespace, args) \
|
Chris@16
|
1136 BOOST_PARAMETER_CONSTRUCTOR_AUX( \
|
Chris@16
|
1137 class_, base, tag_namespace \
|
Chris@16
|
1138 , BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
|
Chris@16
|
1139 )
|
Chris@16
|
1140 /**/
|
Chris@16
|
1141
|
Chris@16
|
1142 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
Chris@16
|
1143 # define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
|
Chris@16
|
1144 (BOOST_PP_IF( \
|
Chris@16
|
1145 BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
|
Chris@16
|
1146 BOOST_PARAMETER_FN_ARG_NAME(elem) \
|
Chris@16
|
1147 ) \
|
Chris@16
|
1148 , (const ParameterArgumentType ## i)(ParameterArgumentType ## i) \
|
Chris@16
|
1149 , (const ParameterArgumentType ## i) \
|
Chris@16
|
1150 ))
|
Chris@16
|
1151 // MSVC6.5 lets us bind rvalues to T&.
|
Chris@16
|
1152 # elif BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
Chris@16
|
1153 # define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
|
Chris@16
|
1154 (BOOST_PP_IF( \
|
Chris@16
|
1155 BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
|
Chris@16
|
1156 BOOST_PARAMETER_FN_ARG_NAME(elem) \
|
Chris@16
|
1157 ) \
|
Chris@16
|
1158 , (ParameterArgumentType ## i) \
|
Chris@16
|
1159 , (const ParameterArgumentType ## i) \
|
Chris@16
|
1160 ))
|
Chris@16
|
1161 // No partial ordering. This feature doesn't work.
|
Chris@16
|
1162 // This is exactly the same as for VC6.5, but we might change it later.
|
Chris@16
|
1163 # else
|
Chris@16
|
1164 # define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
|
Chris@16
|
1165 (BOOST_PP_IF( \
|
Chris@16
|
1166 BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
|
Chris@16
|
1167 BOOST_PARAMETER_FN_ARG_NAME(elem) \
|
Chris@16
|
1168 ) \
|
Chris@16
|
1169 , (ParameterArgumentType ## i) \
|
Chris@16
|
1170 , (const ParameterArgumentType ## i) \
|
Chris@16
|
1171 ))
|
Chris@16
|
1172 # endif
|
Chris@16
|
1173
|
Chris@16
|
1174 # define BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
|
Chris@16
|
1175 BOOST_PP_SEQ_FOR_EACH_I(BOOST_PARAMETER_FUNCTION_FWD_COMBINATION, ~, args)
|
Chris@16
|
1176
|
Chris@16
|
1177 #endif // BOOST_PARAMETER_PREPROCESSOR_060206_HPP
|
Chris@16
|
1178
|