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