1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/parameter/preprocessor.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1169 @@
1.4 +// Copyright Daniel Wallin 2006. Use, modification and distribution is
1.5 +// subject to the Boost Software License, Version 1.0. (See accompanying
1.6 +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1.7 +
1.8 +#ifndef BOOST_PARAMETER_PREPROCESSOR_060206_HPP
1.9 +# define BOOST_PARAMETER_PREPROCESSOR_060206_HPP
1.10 +
1.11 +# include <boost/parameter/parameters.hpp>
1.12 +# include <boost/parameter/binding.hpp>
1.13 +# include <boost/parameter/match.hpp>
1.14 +
1.15 +# include <boost/parameter/aux_/parenthesized_type.hpp>
1.16 +# include <boost/parameter/aux_/cast.hpp>
1.17 +# include <boost/parameter/aux_/preprocessor/flatten.hpp>
1.18 +
1.19 +# include <boost/preprocessor/repetition/repeat_from_to.hpp>
1.20 +# include <boost/preprocessor/control/if.hpp>
1.21 +# include <boost/preprocessor/control/expr_if.hpp>
1.22 +# include <boost/preprocessor/repetition/enum_params.hpp>
1.23 +# include <boost/preprocessor/repetition/enum_binary_params.hpp>
1.24 +# include <boost/preprocessor/repetition/enum_trailing.hpp>
1.25 +# include <boost/preprocessor/seq/first_n.hpp>
1.26 +# include <boost/preprocessor/seq/for_each_product.hpp>
1.27 +# include <boost/preprocessor/seq/for_each_i.hpp>
1.28 +# include <boost/preprocessor/tuple/elem.hpp>
1.29 +# include <boost/preprocessor/seq/fold_left.hpp>
1.30 +# include <boost/preprocessor/seq/size.hpp>
1.31 +# include <boost/preprocessor/seq/enum.hpp>
1.32 +
1.33 +# include <boost/preprocessor/detail/is_nullary.hpp>
1.34 +
1.35 +# include <boost/mpl/always.hpp>
1.36 +# include <boost/mpl/apply_wrap.hpp>
1.37 +
1.38 +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
1.39 +# include <boost/type.hpp>
1.40 +# endif
1.41 +
1.42 +namespace boost { namespace parameter { namespace aux {
1.43 +
1.44 +# ifndef BOOST_NO_SFINAE
1.45 +
1.46 +// Given Match, which is "void x" where x is an argument matching
1.47 +// criterion, extract a corresponding MPL predicate.
1.48 +template <class Match>
1.49 +struct unwrap_predicate;
1.50 +
1.51 +// Match anything
1.52 +template <>
1.53 +struct unwrap_predicate<void*>
1.54 +{
1.55 + typedef mpl::always<mpl::true_> type;
1.56 +};
1.57 +
1.58 +#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
1.59 +
1.60 +typedef void* voidstar;
1.61 +
1.62 +// A matching predicate is explicitly specified
1.63 +template <class Predicate>
1.64 +struct unwrap_predicate<voidstar (Predicate)>
1.65 +{
1.66 + typedef Predicate type;
1.67 +};
1.68 +
1.69 +#else
1.70 +
1.71 +// A matching predicate is explicitly specified
1.72 +template <class Predicate>
1.73 +struct unwrap_predicate<void *(Predicate)>
1.74 +{
1.75 + typedef Predicate type;
1.76 +};
1.77 +
1.78 +#endif
1.79 +
1.80 +
1.81 +// A type to which the argument is supposed to be convertible is
1.82 +// specified
1.83 +template <class Target>
1.84 +struct unwrap_predicate<void (Target)>
1.85 +{
1.86 + typedef is_convertible<mpl::_, Target> type;
1.87 +};
1.88 +
1.89 +// Recast the ParameterSpec's nested match metafunction as a free metafunction
1.90 +template <
1.91 + class Parameters
1.92 + , BOOST_PP_ENUM_BINARY_PARAMS(
1.93 + BOOST_PARAMETER_MAX_ARITY, class A, = boost::parameter::void_ BOOST_PP_INTERCEPT
1.94 + )
1.95 +>
1.96 +struct match
1.97 + : Parameters::template match<
1.98 + BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, A)
1.99 + >
1.100 +{};
1.101 +# endif
1.102 +
1.103 +# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
1.104 +
1.105 +// Function template argument deduction does many of the same things
1.106 +// as type matching during partial specialization, so we call a
1.107 +// function template to "store" T into the type memory addressed by
1.108 +// void(*)(T).
1.109 +template <class T>
1.110 +msvc_store_type<T,void*(*)(void**(T))>
1.111 +msvc_store_predicate_type(void*(*)(void**(T)));
1.112 +
1.113 +template <class T>
1.114 +msvc_store_type<boost::is_convertible<mpl::_,T>,void*(*)(void*(T))>
1.115 +msvc_store_predicate_type(void*(*)(void*(T)));
1.116 +
1.117 +template <class FunctionType>
1.118 +struct unwrap_predicate
1.119 +{
1.120 + static FunctionType f;
1.121 +
1.122 + // We don't want the function to be evaluated, just instantiated,
1.123 + // so protect it inside of sizeof.
1.124 + enum { dummy = sizeof(msvc_store_predicate_type(f)) };
1.125 +
1.126 + // Now pull the type out of the instantiated base class
1.127 + typedef typename msvc_type_memory<FunctionType>::storage::type type;
1.128 +};
1.129 +
1.130 +template <>
1.131 +struct unwrap_predicate<void*(*)(void**)>
1.132 +{
1.133 + typedef mpl::always<mpl::true_> type;
1.134 +};
1.135 +
1.136 +# endif
1.137 +
1.138 +# undef false_
1.139 +
1.140 +template <
1.141 + class Parameters
1.142 + , BOOST_PP_ENUM_BINARY_PARAMS(
1.143 + BOOST_PARAMETER_MAX_ARITY, class A, = boost::parameter::void_ BOOST_PP_INTERCEPT
1.144 + )
1.145 +>
1.146 +struct argument_pack
1.147 +{
1.148 + typedef typename make_arg_list<
1.149 + typename BOOST_PARAMETER_build_arg_list(
1.150 + BOOST_PARAMETER_MAX_ARITY, make_items, typename Parameters::parameter_spec, A
1.151 + )::type
1.152 + , typename Parameters::deduced_list
1.153 + , tag_keyword_arg
1.154 + , mpl::false_
1.155 + >::type type;
1.156 +};
1.157 +
1.158 +# if 1 //BOOST_WORKAROUND(BOOST_MSVC, < 1300)
1.159 +// Works around VC6 problem where it won't accept rvalues.
1.160 +template <class T>
1.161 +T& as_lvalue(T& value, long)
1.162 +{
1.163 + return value;
1.164 +}
1.165 +
1.166 +template <class T>
1.167 +T const& as_lvalue(T const& value, int)
1.168 +{
1.169 + return value;
1.170 +}
1.171 +# endif
1.172 +
1.173 +
1.174 +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
1.175 + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
1.176 +
1.177 +template <class Predicate, class T, class Args>
1.178 +struct apply_predicate
1.179 +{
1.180 + BOOST_MPL_ASSERT((
1.181 + mpl::and_<mpl::false_,T>
1.182 + ));
1.183 +
1.184 + typedef typename mpl::if_<
1.185 + typename mpl::apply2<Predicate,T,Args>::type
1.186 + , char
1.187 + , int
1.188 + >::type type;
1.189 +};
1.190 +
1.191 +template <class P>
1.192 +struct funptr_predicate
1.193 +{
1.194 + static P p;
1.195 +
1.196 + template <class T, class Args, class P0>
1.197 + static typename apply_predicate<P0,T,Args>::type
1.198 + check_predicate(type<T>, Args*, void**(*)(P0));
1.199 +
1.200 + template <class T, class Args, class P0>
1.201 + static typename mpl::if_<
1.202 + is_convertible<T,P0>
1.203 + , char
1.204 + , int
1.205 + >::type check_predicate(type<T>, Args*, void*(*)(P0));
1.206 +
1.207 + template <class T, class Args>
1.208 + struct apply
1.209 + {
1.210 + BOOST_STATIC_CONSTANT(bool, result =
1.211 + sizeof(check_predicate(boost::type<T>(), (Args*)0, &p)) == 1
1.212 + );
1.213 +
1.214 + typedef mpl::bool_<apply<T,Args>::result> type;
1.215 + };
1.216 +};
1.217 +
1.218 +template <>
1.219 +struct funptr_predicate<void**>
1.220 + : mpl::always<mpl::true_>
1.221 +{};
1.222 +
1.223 +# endif
1.224 +
1.225 +}}} // namespace boost::parameter::aux
1.226 +
1.227 +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
1.228 +// From Paul Mensonides
1.229 +# define BOOST_PARAMETER_IS_NULLARY(x) \
1.230 + BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_NULLARY_C x BOOST_PP_COMMA() 0) \
1.231 + /**/
1.232 +# define BOOST_PARAMETER_IS_NULLARY_C() \
1.233 + ~, 1 BOOST_PP_RPAREN() \
1.234 + BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \
1.235 + /**/
1.236 +# else
1.237 +# define BOOST_PARAMETER_IS_NULLARY(x) BOOST_PP_IS_NULLARY(x)
1.238 +# endif
1.239 +
1.240 +# define BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_static ()
1.241 +# define BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
1.242 + BOOST_PARAMETER_IS_NULLARY( \
1.243 + BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_,name) \
1.244 + )
1.245 +
1.246 +# if !defined(BOOST_MSVC)
1.247 +# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static
1.248 +# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \
1.249 + BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name)
1.250 +# else
1.251 +// Workaround for MSVC preprocessor.
1.252 +//
1.253 +// When stripping static from "static f", msvc will produce
1.254 +// " f". The leading whitespace doesn't go away when pasting
1.255 +// the token with something else, so this thing is a hack to
1.256 +// strip the whitespace.
1.257 +# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static (
1.258 +# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \
1.259 + BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name))
1.260 +# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \
1.261 + BOOST_PP_SEQ_HEAD( \
1.262 + BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \
1.263 + )
1.264 +# endif
1.265 +
1.266 +# define BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
1.267 + BOOST_PP_EXPR_IF( \
1.268 + BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
1.269 + , static \
1.270 + )
1.271 +
1.272 +# define BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name) \
1.273 + BOOST_PP_IF( \
1.274 + BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
1.275 + , BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC \
1.276 + , name BOOST_PP_TUPLE_EAT(1) \
1.277 + )(name)
1.278 +
1.279 +// Calculates [begin, end) arity range.
1.280 +
1.281 +# define BOOST_PARAMETER_ARITY_RANGE_M_optional(state) state
1.282 +# define BOOST_PARAMETER_ARITY_RANGE_M_deduced_optional(state) state
1.283 +# define BOOST_PARAMETER_ARITY_RANGE_M_required(state) BOOST_PP_INC(state)
1.284 +# define BOOST_PARAMETER_ARITY_RANGE_M_deduced_required(state) BOOST_PP_INC(state)
1.285 +
1.286 +# define BOOST_PARAMETER_ARITY_RANGE_M(s, state, x) \
1.287 + BOOST_PP_CAT( \
1.288 + BOOST_PARAMETER_ARITY_RANGE_M_ \
1.289 + , BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
1.290 + )(state)
1.291 +/**/
1.292 +
1.293 +# define BOOST_PARAMETER_ARITY_RANGE(args) \
1.294 + ( \
1.295 + BOOST_PP_SEQ_FOLD_LEFT(BOOST_PARAMETER_ARITY_RANGE_M, 0, args) \
1.296 + , BOOST_PP_INC(BOOST_PP_SEQ_SIZE(args)) \
1.297 + )
1.298 +/**/
1.299 +
1.300 +// Accessor macros for the argument specs tuple.
1.301 +# define BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
1.302 + BOOST_PP_TUPLE_ELEM(4,0,x)
1.303 +/**/
1.304 +
1.305 +# define BOOST_PARAMETER_FN_ARG_NAME(x) \
1.306 + BOOST_PP_TUPLE_ELEM(4,1,x)
1.307 +/**/
1.308 +
1.309 +# define BOOST_PARAMETER_FN_ARG_PRED(x) \
1.310 + BOOST_PP_TUPLE_ELEM(4,2,x)
1.311 +/**/
1.312 +
1.313 +# define BOOST_PARAMETER_FN_ARG_DEFAULT(x) \
1.314 + BOOST_PP_TUPLE_ELEM(4,3,x)
1.315 +/**/
1.316 +
1.317 +# define BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_out(x)
1.318 +# define BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_in_out(x)
1.319 +
1.320 +// Returns 1 if x is either "out(k)" or "in_out(k)".
1.321 +# define BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER(x) \
1.322 + BOOST_PP_IS_EMPTY( \
1.323 + BOOST_PP_CAT(BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_, x) \
1.324 + ) \
1.325 +/**/
1.326 +
1.327 +# define BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_out(x) x
1.328 +# define BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_in_out(x) x
1.329 +# define BOOST_PARAMETER_FUNCTION_KEYWORD_GET(x) \
1.330 + BOOST_PP_CAT(BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_, x)
1.331 +/**/
1.332 +
1.333 +// Returns the keyword of x, where x is either a keyword qualifier
1.334 +// or a keyword.
1.335 +//
1.336 +// k => k
1.337 +// out(k) => k
1.338 +// in_out(k) => k
1.339 +//
1.340 +# define BOOST_PARAMETER_FUNCTION_KEYWORD(x) \
1.341 + BOOST_PP_IF( \
1.342 + BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER(x) \
1.343 + , BOOST_PARAMETER_FUNCTION_KEYWORD_GET \
1.344 + , x BOOST_PP_TUPLE_EAT(1) \
1.345 + )(x)
1.346 +/**/
1.347 +
1.348 +# define BOOST_PARAMETER_FN_ARG_KEYWORD(x) \
1.349 + BOOST_PARAMETER_FUNCTION_KEYWORD( \
1.350 + BOOST_PARAMETER_FN_ARG_NAME(x) \
1.351 + )
1.352 +
1.353 +// Builds forwarding functions.
1.354 +
1.355 +# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z(z, n) \
1.356 + template<BOOST_PP_ENUM_PARAMS_Z(z, n, class ParameterArgumentType)>
1.357 +/**/
1.358 +
1.359 +# ifndef BOOST_NO_SFINAE
1.360 +# define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n) \
1.361 + , typename boost::parameter::aux::match< \
1.362 + parameters, BOOST_PP_ENUM_PARAMS(n, ParameterArgumentType) \
1.363 + >::type boost_parameter_enabler_argument = parameters()
1.364 +# else
1.365 +# define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n)
1.366 +# endif
1.367 +/**/
1.368 +
1.369 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(base) \
1.370 + BOOST_PP_CAT( \
1.371 + boost_param_parameters_ \
1.372 + , BOOST_PP_CAT(__LINE__, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base)) \
1.373 + )
1.374 +
1.375 +// Produce a name for a result type metafunction for the function
1.376 +// named base
1.377 +# define BOOST_PARAMETER_FUNCTION_RESULT_NAME(base) \
1.378 + BOOST_PP_CAT( \
1.379 + boost_param_result_ \
1.380 + , BOOST_PP_CAT(__LINE__,BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base)) \
1.381 + )
1.382 +
1.383 +// Can't do boost_param_impl_ ## basee because base might start with an underscore
1.384 +// daniel: what? how is that relevant? the reason for using CAT() is to make sure
1.385 +// base is expanded. i'm not sure we need to here, but it's more stable to do it.
1.386 +# define BOOST_PARAMETER_IMPL(base) \
1.387 + BOOST_PP_CAT(boost_param_impl,BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base))
1.388 +
1.389 +# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00(z, n, r, data, elem) \
1.390 + BOOST_PP_IF( \
1.391 + n \
1.392 + , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z, BOOST_PP_TUPLE_EAT(2) \
1.393 + )(z,n) \
1.394 + BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(7,3,data)) \
1.395 + inline \
1.396 + BOOST_PP_EXPR_IF(n, typename) \
1.397 + BOOST_PARAMETER_FUNCTION_RESULT_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))< \
1.398 + BOOST_PP_EXPR_IF(n, typename) \
1.399 + boost::parameter::aux::argument_pack< \
1.400 + BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data)) \
1.401 + BOOST_PP_COMMA_IF(n) \
1.402 + BOOST_PP_IF( \
1.403 + n, BOOST_PP_SEQ_ENUM, BOOST_PP_TUPLE_EAT(1) \
1.404 + )(elem) \
1.405 + >::type \
1.406 + >::type \
1.407 + BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))( \
1.408 + BOOST_PP_IF( \
1.409 + n \
1.410 + , BOOST_PP_SEQ_FOR_EACH_I_R \
1.411 + , BOOST_PP_TUPLE_EAT(4) \
1.412 + )( \
1.413 + r \
1.414 + , BOOST_PARAMETER_FUNCTION_ARGUMENT \
1.415 + , ~ \
1.416 + , elem \
1.417 + ) \
1.418 + BOOST_PP_IF(n, BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z, BOOST_PP_TUPLE_EAT(4))( \
1.419 + z \
1.420 + , BOOST_PP_TUPLE_ELEM(7,3,data) \
1.421 + , BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data)) \
1.422 + , n \
1.423 + ) \
1.424 + ) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(7,4,data), const) \
1.425 + { \
1.426 + return BOOST_PARAMETER_IMPL(BOOST_PP_TUPLE_ELEM(7,3,data))( \
1.427 + BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))()( \
1.428 + BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
1.429 + ) \
1.430 + ); \
1.431 + }
1.432 +/**/
1.433 +
1.434 +# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION0(r, data, elem) \
1.435 + BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00( \
1.436 + BOOST_PP_TUPLE_ELEM(7,0,data) \
1.437 + , BOOST_PP_TUPLE_ELEM(7,1,data) \
1.438 + , r \
1.439 + , data \
1.440 + , elem \
1.441 + )
1.442 +/**/
1.443 +
1.444 +# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_0(z, n, data) \
1.445 + BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00( \
1.446 + z, n, BOOST_PP_DEDUCE_R() \
1.447 + , (z, n, BOOST_PP_TUPLE_REM(5) data) \
1.448 + , ~ \
1.449 + )
1.450 +/**/
1.451 +
1.452 +# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_N(z, n, data) \
1.453 + BOOST_PP_SEQ_FOR_EACH( \
1.454 + BOOST_PARAMETER_FUNCTION_FWD_FUNCTION0 \
1.455 + , (z, n, BOOST_PP_TUPLE_REM(5) data) \
1.456 + , BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
1.457 + BOOST_PARAMETER_FUNCTION_FWD_PRODUCT \
1.458 + , BOOST_PP_SEQ_FIRST_N( \
1.459 + n, BOOST_PP_TUPLE_ELEM(5,3,data) \
1.460 + ) \
1.461 + ) \
1.462 + )
1.463 +/**/
1.464 +
1.465 +# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION(z, n, data) \
1.466 + BOOST_PP_IF( \
1.467 + n \
1.468 + , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_N \
1.469 + , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_0 \
1.470 + )(z,n,data) \
1.471 +/**/
1.472 +
1.473 +# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS0( \
1.474 + result,name,args,const_,combinations,range \
1.475 +) \
1.476 + BOOST_PP_REPEAT_FROM_TO( \
1.477 + BOOST_PP_TUPLE_ELEM(2,0,range), BOOST_PP_TUPLE_ELEM(2,1,range) \
1.478 + , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION \
1.479 + , (result,name,const_,combinations,BOOST_PP_TUPLE_ELEM(2,1,range)) \
1.480 + )
1.481 +/**/
1.482 +
1.483 +# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS(result,name,args, const_, combinations) \
1.484 + BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS0( \
1.485 + result, name, args, const_, combinations, BOOST_PARAMETER_ARITY_RANGE(args) \
1.486 + )
1.487 +/**/
1.488 +
1.489 +// Builds boost::parameter::parameters<> specialization
1.490 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_optional(tag) \
1.491 + optional<tag
1.492 +
1.493 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_required(tag) \
1.494 + required<tag
1.495 +
1.496 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_deduced_optional(tag) \
1.497 + optional<boost::parameter::deduced<tag>
1.498 +
1.499 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_deduced_required(tag) \
1.500 + required<boost::parameter::deduced<tag>
1.501 +
1.502 +# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
1.503 +
1.504 +# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
1.505 +# define BOOST_PARAMETER_PREDICATE_TYPE(p) void*(*) (void* p)
1.506 +# else
1.507 +# define BOOST_PARAMETER_PREDICATE_TYPE(p) void p
1.508 +# endif
1.509 +
1.510 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
1.511 + BOOST_PP_COMMA_IF(i) \
1.512 + boost::parameter::BOOST_PP_CAT( \
1.513 + BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
1.514 + , BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
1.515 + )( \
1.516 + tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
1.517 + BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
1.518 + ) \
1.519 + ) \
1.520 + , typename boost::parameter::aux::unwrap_predicate< \
1.521 + BOOST_PARAMETER_PREDICATE_TYPE(BOOST_PARAMETER_FN_ARG_PRED(elem)) \
1.522 + >::type \
1.523 + >
1.524 +# elif BOOST_WORKAROUND(BOOST_MSVC, < 1300)
1.525 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
1.526 + BOOST_PP_COMMA_IF(i) \
1.527 + boost::parameter::BOOST_PP_CAT( \
1.528 + BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
1.529 + , BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
1.530 + )( \
1.531 + tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
1.532 + BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
1.533 + ) \
1.534 + ) \
1.535 + , boost::parameter::aux::funptr_predicate< \
1.536 + void* BOOST_PARAMETER_FN_ARG_PRED(elem) \
1.537 + > \
1.538 + >
1.539 +# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
1.540 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
1.541 + BOOST_PP_COMMA_IF(i) \
1.542 + boost::parameter::BOOST_PP_CAT( \
1.543 + BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
1.544 + , BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
1.545 + )( \
1.546 + tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
1.547 + BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
1.548 + ) \
1.549 + ) \
1.550 + , boost::mpl::always<boost::mpl::true_> \
1.551 + >
1.552 +# endif
1.553 +
1.554 +# define BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, base, args) \
1.555 + template <class BoostParameterDummy> \
1.556 + struct BOOST_PP_CAT( \
1.557 + BOOST_PP_CAT(boost_param_params_, __LINE__) \
1.558 + , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
1.559 + ) : boost::parameter::parameters< \
1.560 + BOOST_PP_SEQ_FOR_EACH_I( \
1.561 + BOOST_PARAMETER_FUNCTION_PARAMETERS_M, tag_namespace, args \
1.562 + ) \
1.563 + > \
1.564 + {}; \
1.565 + \
1.566 + typedef BOOST_PP_CAT( \
1.567 + BOOST_PP_CAT(boost_param_params_, __LINE__) \
1.568 + , BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
1.569 + )<int>
1.570 +
1.571 +// Defines result type metafunction
1.572 +# define BOOST_PARAMETER_FUNCTION_RESULT_ARG(z, _, i, x) \
1.573 + BOOST_PP_COMMA_IF(i) class BOOST_PP_TUPLE_ELEM(3,1,x)
1.574 +/**/
1.575 +
1.576 +# define BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args) \
1.577 + template <class Args> \
1.578 + struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name) \
1.579 + { \
1.580 + typedef typename BOOST_PARAMETER_PARENTHESIZED_TYPE(result) type; \
1.581 + };
1.582 +
1.583 +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
1.584 +
1.585 +# define BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
1.586 + BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args) \
1.587 + template <> \
1.588 + struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<int> \
1.589 + { typedef int type; };
1.590 +
1.591 +# else
1.592 +
1.593 +# define BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
1.594 + BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args)
1.595 +
1.596 +# endif
1.597 +
1.598 +// Defines implementation function
1.599 +# define BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name) \
1.600 + template <class Args> \
1.601 + typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)< \
1.602 + Args \
1.603 + >::type BOOST_PARAMETER_IMPL(name)(Args const& args)
1.604 +
1.605 +# define BOOST_PARAMETER_FUNCTION_IMPL_FWD(name) \
1.606 + BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name);
1.607 +/**/
1.608 +
1.609 +# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(state, arg) \
1.610 + ( \
1.611 + BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 0, state)) \
1.612 + , BOOST_PP_SEQ_PUSH_BACK(BOOST_PP_TUPLE_ELEM(4, 1, state), arg) \
1.613 + , BOOST_PP_TUPLE_ELEM(4, 2, state) \
1.614 + , BOOST_PP_TUPLE_ELEM(4, 3, state) \
1.615 + )
1.616 +
1.617 +# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_required(state, arg) \
1.618 + BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(state, arg)
1.619 +
1.620 +# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(state, arg) \
1.621 + ( \
1.622 + BOOST_PP_TUPLE_ELEM(4, 0, state) \
1.623 + , BOOST_PP_TUPLE_ELEM(4, 1, state) \
1.624 + , BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 2, state)) \
1.625 + , BOOST_PP_SEQ_PUSH_BACK(BOOST_PP_TUPLE_ELEM(4, 3, state), arg) \
1.626 + )
1.627 +
1.628 +# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_optional(state, arg) \
1.629 + BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(state, arg)
1.630 +
1.631 +# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG(s, state, arg) \
1.632 + BOOST_PP_CAT( \
1.633 + BOOST_PARAMETER_FUNCTION_SPLIT_ARG_ \
1.634 + , BOOST_PARAMETER_FN_ARG_QUALIFIER(arg) \
1.635 + )(state, arg)
1.636 +
1.637 +// Returns (required_count, required, optional_count, optionals) tuple
1.638 +# define BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args) \
1.639 + BOOST_PP_SEQ_FOLD_LEFT( \
1.640 + BOOST_PARAMETER_FUNCTION_SPLIT_ARG \
1.641 + , (0,BOOST_PP_SEQ_NIL, 0,BOOST_PP_SEQ_NIL) \
1.642 + , args \
1.643 + )
1.644 +
1.645 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME(keyword) \
1.646 + BOOST_PP_CAT(BOOST_PP_CAT(keyword,_),type)
1.647 +
1.648 +// Helpers used as parameters to BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS.
1.649 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG(r, _, arg) \
1.650 + , class BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME( \
1.651 + BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
1.652 + )
1.653 +
1.654 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG(r, _, arg) \
1.655 + , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME( \
1.656 + BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
1.657 + )& BOOST_PARAMETER_FN_ARG_KEYWORD(arg)
1.658 +
1.659 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER(r, _, arg) \
1.660 + , BOOST_PARAMETER_FN_ARG_KEYWORD(arg)
1.661 +
1.662 +// Produces a name for the dispatch functions.
1.663 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name) \
1.664 + BOOST_PP_CAT( \
1.665 + boost_param_default_ \
1.666 + , BOOST_PP_CAT(__LINE__, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name)) \
1.667 + )
1.668 +
1.669 +// Helper macro used below to produce lists based on the keyword argument
1.670 +// names. macro is applied to every element. n is the number of
1.671 +// optional arguments that should be included.
1.672 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS(macro, n, split_args) \
1.673 + BOOST_PP_SEQ_FOR_EACH( \
1.674 + macro \
1.675 + , ~ \
1.676 + , BOOST_PP_TUPLE_ELEM(4,1,split_args) \
1.677 + ) \
1.678 + BOOST_PP_SEQ_FOR_EACH( \
1.679 + macro \
1.680 + , ~ \
1.681 + , BOOST_PP_SEQ_FIRST_N( \
1.682 + BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), n) \
1.683 + , BOOST_PP_TUPLE_ELEM(4,3,split_args) \
1.684 + ) \
1.685 + )
1.686 +
1.687 +// Generates a keyword | default expression.
1.688 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT(arg, tag_namespace) \
1.689 + boost::parameter::keyword< \
1.690 + tag_namespace::BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
1.691 + >::get() | boost::parameter::aux::use_default_tag()
1.692 +
1.693 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_GET_ARG(arg, tag_ns) \
1.694 + BOOST_PARAMETER_FUNCTION_CAST( \
1.695 + args[ \
1.696 + BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT( \
1.697 + arg, tag_ns \
1.698 + ) \
1.699 + ] \
1.700 + , BOOST_PARAMETER_FN_ARG_PRED(arg) \
1.701 + )
1.702 +
1.703 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY(name, n, split_args, tag_namespace) \
1.704 + { \
1.705 + return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
1.706 + (ResultType(*)())0 \
1.707 + , args \
1.708 + , 0L \
1.709 + BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
1.710 + BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER \
1.711 + , n \
1.712 + , split_args \
1.713 + ) \
1.714 + , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_GET_ARG( \
1.715 + BOOST_PP_SEQ_ELEM( \
1.716 + BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), n) \
1.717 + , BOOST_PP_TUPLE_ELEM(4,3,split_args) \
1.718 + ) \
1.719 + , tag_namespace \
1.720 + ) \
1.721 + ); \
1.722 + }
1.723 +
1.724 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_ACTUAL_DEFAULT(arg) \
1.725 + BOOST_PARAMETER_FUNCTION_CAST( \
1.726 + boost::parameter::aux::as_lvalue(BOOST_PARAMETER_FN_ARG_DEFAULT(arg), 0L) \
1.727 + , BOOST_PARAMETER_FN_ARG_PRED(arg) \
1.728 + )
1.729 +
1.730 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY(name, n, split_args, tag_ns, const_) \
1.731 + template < \
1.732 + class ResultType \
1.733 + , class Args \
1.734 + BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
1.735 + BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
1.736 + , BOOST_PP_INC(n) \
1.737 + , split_args \
1.738 + ) \
1.739 + > \
1.740 + BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
1.741 + ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
1.742 + ResultType(*)() \
1.743 + , Args const& args \
1.744 + , long \
1.745 + BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
1.746 + BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
1.747 + , BOOST_PP_INC(n) \
1.748 + , split_args \
1.749 + ) \
1.750 + , boost::parameter::aux::use_default_tag \
1.751 + ) BOOST_PP_EXPR_IF(const_, const) \
1.752 + { \
1.753 + return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
1.754 + (ResultType(*)())0 \
1.755 + , args \
1.756 + , 0L \
1.757 + BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
1.758 + BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER \
1.759 + , BOOST_PP_INC(n) \
1.760 + , split_args \
1.761 + ) \
1.762 + , BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_ACTUAL_DEFAULT( \
1.763 + BOOST_PP_SEQ_ELEM( \
1.764 + BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), BOOST_PP_INC(n)) \
1.765 + , BOOST_PP_TUPLE_ELEM(4,3,split_args) \
1.766 + ) \
1.767 + ) \
1.768 + ); \
1.769 + }
1.770 +
1.771 +// Produces a forwarding layer in the default evaluation machine.
1.772 +//
1.773 +// data is a tuple:
1.774 +//
1.775 +// (name, split_args)
1.776 +//
1.777 +// Where name is the base name of the function, and split_args is a tuple:
1.778 +//
1.779 +// (required_count, required_args, optional_count, required_args)
1.780 +//
1.781 +
1.782 +
1.783 +// defines the actual function body for BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION below.
1.784 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION0(z, n, data) \
1.785 + template < \
1.786 + class ResultType \
1.787 + , class Args \
1.788 + BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
1.789 + BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
1.790 + , n \
1.791 + , BOOST_PP_TUPLE_ELEM(5,1,data) \
1.792 + ) \
1.793 + > \
1.794 + BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(5,0,data)) \
1.795 + ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(BOOST_PP_TUPLE_ELEM(5,0,data))( \
1.796 + ResultType(*)() \
1.797 + , Args const& args \
1.798 + , int \
1.799 + BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
1.800 + BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
1.801 + , n \
1.802 + , BOOST_PP_TUPLE_ELEM(5,1,data) \
1.803 + ) \
1.804 + ) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(5,2,data), const) \
1.805 + BOOST_PP_IF( \
1.806 + n \
1.807 + , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY \
1.808 + , ; BOOST_PP_TUPLE_EAT(4) \
1.809 + )( \
1.810 + BOOST_PP_TUPLE_ELEM(5,0,data) \
1.811 + , n \
1.812 + , BOOST_PP_TUPLE_ELEM(5,1,data) \
1.813 + , BOOST_PP_TUPLE_ELEM(5,3,data) \
1.814 + )
1.815 +
1.816 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION(z, n, data) \
1.817 + BOOST_PP_IF( \
1.818 + BOOST_PP_AND( \
1.819 + BOOST_PP_NOT(n) \
1.820 + , BOOST_PP_TUPLE_ELEM(5,4,data) \
1.821 + ) \
1.822 + , BOOST_PP_TUPLE_EAT(3) \
1.823 + , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION0 \
1.824 + )(z, n, data) \
1.825 + BOOST_PP_IF( \
1.826 + BOOST_PP_EQUAL(n, BOOST_PP_TUPLE_ELEM(4,2,BOOST_PP_TUPLE_ELEM(5,1,data))) \
1.827 + , BOOST_PP_TUPLE_EAT(5) \
1.828 + , BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY \
1.829 + )( \
1.830 + BOOST_PP_TUPLE_ELEM(5,0,data) \
1.831 + , n \
1.832 + , BOOST_PP_TUPLE_ELEM(5,1,data) \
1.833 + , BOOST_PP_TUPLE_ELEM(5,3,data) \
1.834 + , BOOST_PP_TUPLE_ELEM(5,2,data) \
1.835 + )
1.836 +
1.837 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_GET_ARG(r, tag_ns, arg) \
1.838 + , BOOST_PARAMETER_FUNCTION_CAST( \
1.839 + args[ \
1.840 + boost::parameter::keyword<tag_ns::BOOST_PARAMETER_FN_ARG_KEYWORD(arg)>::get() \
1.841 + ] \
1.842 + , BOOST_PARAMETER_FN_ARG_PRED(arg) \
1.843 + )
1.844 +
1.845 +// Generates the function template that recives a ArgumentPack, and then
1.846 +// goes on to call the layers of overloads generated by
1.847 +// BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER.
1.848 +# define BOOST_PARAMETER_FUNCTION_INITIAL_DISPATCH_FUNCTION(name, split_args, const_, tag_ns) \
1.849 + template <class Args> \
1.850 + typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<Args>::type \
1.851 + BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
1.852 + BOOST_PARAMETER_IMPL(name)(Args const& args) BOOST_PP_EXPR_IF(const_, const) \
1.853 + { \
1.854 + return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
1.855 + (typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<Args>::type(*)())0 \
1.856 + , args \
1.857 + , 0L \
1.858 + \
1.859 + BOOST_PP_SEQ_FOR_EACH( \
1.860 + BOOST_PARAMETER_FUNCTION_DEFAULT_GET_ARG \
1.861 + , tag_ns \
1.862 + , BOOST_PP_TUPLE_ELEM(4,1,split_args) \
1.863 + ) \
1.864 + \
1.865 + ); \
1.866 + }
1.867 +
1.868 +// Helper for BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER below.
1.869 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER_AUX( \
1.870 + name, split_args, skip_fwd_decl, const_, tag_namespace \
1.871 + ) \
1.872 + BOOST_PP_REPEAT_FROM_TO( \
1.873 + 0 \
1.874 + , BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 2, split_args)) \
1.875 + , BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION \
1.876 + , (name, split_args, const_, tag_namespace, skip_fwd_decl) \
1.877 + ) \
1.878 + \
1.879 + BOOST_PARAMETER_FUNCTION_INITIAL_DISPATCH_FUNCTION(name, split_args, const_, tag_namespace) \
1.880 +\
1.881 + template < \
1.882 + class ResultType \
1.883 + , class Args \
1.884 + BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
1.885 + BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
1.886 + , 0 \
1.887 + , split_args \
1.888 + ) \
1.889 + > \
1.890 + BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
1.891 + ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
1.892 + ResultType(*)() \
1.893 + , Args const& args \
1.894 + , int \
1.895 + BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
1.896 + BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
1.897 + , 0 \
1.898 + , split_args \
1.899 + ) \
1.900 + ) BOOST_PP_EXPR_IF(const_, const)
1.901 +
1.902 +// Generates a bunch of forwarding functions that each extract
1.903 +// one more argument.
1.904 +# define BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, skip_fwd_decl, const_, tag_ns) \
1.905 + BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER_AUX( \
1.906 + name, BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args), skip_fwd_decl, const_, tag_ns \
1.907 + )
1.908 +/**/
1.909 +
1.910 +// Defines the result metafunction and the parameters specialization.
1.911 +# define BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
1.912 + BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
1.913 + \
1.914 + BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, name, args) \
1.915 + BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(name); \
1.916 +
1.917 +// Helper for BOOST_PARAMETER_FUNCTION below.
1.918 +# define BOOST_PARAMETER_FUNCTION_AUX(result, name, tag_namespace, args) \
1.919 + BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
1.920 + BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name); \
1.921 +\
1.922 + BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
1.923 + result, name, args, 0 \
1.924 + , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
1.925 + ) \
1.926 + \
1.927 + BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, 0, 0, tag_namespace)
1.928 +
1.929 +// Defines a Boost.Parameter enabled function with the new syntax.
1.930 +# define BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, args) \
1.931 + BOOST_PARAMETER_FUNCTION_AUX( \
1.932 + result, name, tag_namespace \
1.933 + , BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
1.934 + ) \
1.935 +/**/
1.936 +
1.937 +// Defines a Boost.Parameter enabled function.
1.938 +# define BOOST_PARAMETER_BASIC_FUNCTION_AUX(result, name, tag_namespace, args) \
1.939 + BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
1.940 + \
1.941 + BOOST_PARAMETER_FUNCTION_IMPL_FWD(name) \
1.942 + \
1.943 + BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
1.944 + result, name, args, 0 \
1.945 + , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
1.946 + ) \
1.947 + \
1.948 + BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name)
1.949 +
1.950 +# define BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, args) \
1.951 + BOOST_PARAMETER_BASIC_FUNCTION_AUX( \
1.952 + result, name, tag_namespace \
1.953 + , BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
1.954 + ) \
1.955 +/**/
1.956 +
1.957 +// Defines a Boost.Parameter enabled member function.
1.958 +# define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX(result, name, tag_namespace, args, const_) \
1.959 + BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
1.960 + \
1.961 + BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
1.962 + result, name, args, const_ \
1.963 + , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
1.964 + ) \
1.965 + \
1.966 + BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name) BOOST_PP_EXPR_IF(const_, const) \
1.967 +/**/
1.968 +
1.969 +# define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_namespace, args) \
1.970 + BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
1.971 + result, name, tag_namespace \
1.972 + , BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
1.973 + , 0 \
1.974 + )
1.975 +/**/
1.976 +
1.977 +# define BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_namespace, args) \
1.978 + BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
1.979 + result, name, tag_namespace \
1.980 + , BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
1.981 + , 1 \
1.982 + )
1.983 +/**/
1.984 +
1.985 +
1.986 +
1.987 +# define BOOST_PARAMETER_MEMBER_FUNCTION_AUX(result, name, tag_namespace, const_, args) \
1.988 + BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
1.989 +\
1.990 + BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
1.991 + result, name, args, const_ \
1.992 + , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
1.993 + ) \
1.994 + \
1.995 + BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, 1, const_, tag_namespace)
1.996 +
1.997 +// Defines a Boost.Parameter enabled function with the new syntax.
1.998 +# define BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, args) \
1.999 + BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
1.1000 + result, name, tag_namespace, 0 \
1.1001 + , BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
1.1002 + ) \
1.1003 +/**/
1.1004 +
1.1005 +# define BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_namespace, args) \
1.1006 + BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
1.1007 + result, name, tag_namespace, 1 \
1.1008 + , BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
1.1009 + ) \
1.1010 +/**/
1.1011 +
1.1012 +// Defines a Boost.Parameter enabled constructor.
1.1013 +
1.1014 +# define BOOST_PARAMETER_FUNCTION_ARGUMENT(r, _, i, elem) \
1.1015 + BOOST_PP_COMMA_IF(i) elem& BOOST_PP_CAT(a, i)
1.1016 +/**/
1.1017 +
1.1018 +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
1.1019 +
1.1020 +// Older MSVC can't do what's necessary to handle commas in base names; just
1.1021 +// use a typedef instead if you have a base name that contains commas.
1.1022 +# define BOOST_PARAMETER_PARENTHESIZED_BASE(x) BOOST_PP_SEQ_HEAD(x)
1.1023 +
1.1024 +# else
1.1025 +
1.1026 +# define BOOST_PARAMETER_PARENTHESIZED_BASE(x) BOOST_PARAMETER_PARENTHESIZED_TYPE(x)
1.1027 +
1.1028 +# endif
1.1029 +
1.1030 +# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00(z, n, r, data, elem) \
1.1031 + BOOST_PP_IF( \
1.1032 + n \
1.1033 + , BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z, BOOST_PP_TUPLE_EAT(2) \
1.1034 + )(z, n) \
1.1035 + BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n,1), explicit) \
1.1036 + BOOST_PP_TUPLE_ELEM(6,2,data)( \
1.1037 + BOOST_PP_IF( \
1.1038 + n \
1.1039 + , BOOST_PP_SEQ_FOR_EACH_I_R \
1.1040 + , BOOST_PP_TUPLE_EAT(4) \
1.1041 + )( \
1.1042 + r \
1.1043 + , BOOST_PARAMETER_FUNCTION_ARGUMENT \
1.1044 + , ~ \
1.1045 + , elem \
1.1046 + ) \
1.1047 + BOOST_PP_IF(n, BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z, BOOST_PP_TUPLE_EAT(4))( \
1.1048 + z \
1.1049 + , BOOST_PP_TUPLE_ELEM(6,3,data) \
1.1050 + , BOOST_PP_CAT(constructor_parameters, __LINE__) \
1.1051 + , n \
1.1052 + ) \
1.1053 + ) \
1.1054 + : BOOST_PARAMETER_PARENTHESIZED_BASE(BOOST_PP_TUPLE_ELEM(6,3,data)) ( \
1.1055 + BOOST_PP_CAT(constructor_parameters, __LINE__)()( \
1.1056 + BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
1.1057 + ) \
1.1058 + ) \
1.1059 + {}
1.1060 +/**/
1.1061 +
1.1062 +# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR0(r, data, elem) \
1.1063 + BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00( \
1.1064 + BOOST_PP_TUPLE_ELEM(6,0,data) \
1.1065 + , BOOST_PP_TUPLE_ELEM(6,1,data) \
1.1066 + , r \
1.1067 + , data \
1.1068 + , elem \
1.1069 + )
1.1070 +/**/
1.1071 +
1.1072 +# define BOOST_PARAMETER_FUNCTION_FWD_PRODUCT(r, product) \
1.1073 + (product)
1.1074 +/**/
1.1075 +
1.1076 +# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_0(z, n, data) \
1.1077 + BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00( \
1.1078 + z, n, BOOST_PP_DEDUCE_R() \
1.1079 + , (z, n, BOOST_PP_TUPLE_REM(4) data) \
1.1080 + , ~ \
1.1081 + )
1.1082 +/**/
1.1083 +
1.1084 +# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_N(z, n, data) \
1.1085 + BOOST_PP_SEQ_FOR_EACH( \
1.1086 + BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR0 \
1.1087 + , (z, n, BOOST_PP_TUPLE_REM(4) data) \
1.1088 + , BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
1.1089 + BOOST_PARAMETER_FUNCTION_FWD_PRODUCT \
1.1090 + , BOOST_PP_SEQ_FIRST_N( \
1.1091 + n, BOOST_PP_TUPLE_ELEM(4,2,data) \
1.1092 + ) \
1.1093 + ) \
1.1094 + )
1.1095 +/**/
1.1096 +
1.1097 +# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR(z, n, data) \
1.1098 + BOOST_PP_IF( \
1.1099 + n \
1.1100 + , BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_N \
1.1101 + , BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_0 \
1.1102 + )(z,n,data) \
1.1103 +/**/
1.1104 +
1.1105 +# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS0(class_,base,args,combinations,range) \
1.1106 + BOOST_PP_REPEAT_FROM_TO( \
1.1107 + BOOST_PP_TUPLE_ELEM(2,0,range), BOOST_PP_TUPLE_ELEM(2,1,range) \
1.1108 + , BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR \
1.1109 + , (class_,base,combinations,BOOST_PP_TUPLE_ELEM(2,1,range)) \
1.1110 + )
1.1111 +/**/
1.1112 +
1.1113 +# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS(class_,base,args,combinations) \
1.1114 + BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS0( \
1.1115 + class_, base, args, combinations, BOOST_PARAMETER_ARITY_RANGE(args) \
1.1116 + )
1.1117 +/**/
1.1118 +
1.1119 +# define BOOST_PARAMETER_CONSTRUCTOR_AUX(class_, base, tag_namespace, args) \
1.1120 + BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, ctor, args) \
1.1121 + BOOST_PP_CAT(constructor_parameters, __LINE__); \
1.1122 +\
1.1123 + BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS( \
1.1124 + class_, base, args \
1.1125 + , BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
1.1126 + ) \
1.1127 +/**/
1.1128 +
1.1129 +# define BOOST_PARAMETER_CONSTRUCTOR(class_, base, tag_namespace, args) \
1.1130 + BOOST_PARAMETER_CONSTRUCTOR_AUX( \
1.1131 + class_, base, tag_namespace \
1.1132 + , BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
1.1133 + )
1.1134 +/**/
1.1135 +
1.1136 +# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1.1137 +# define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
1.1138 + (BOOST_PP_IF( \
1.1139 + BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
1.1140 + BOOST_PARAMETER_FN_ARG_NAME(elem) \
1.1141 + ) \
1.1142 + , (const ParameterArgumentType ## i)(ParameterArgumentType ## i) \
1.1143 + , (const ParameterArgumentType ## i) \
1.1144 + ))
1.1145 +// MSVC6.5 lets us bind rvalues to T&.
1.1146 +# elif BOOST_WORKAROUND(BOOST_MSVC, < 1300)
1.1147 +# define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
1.1148 + (BOOST_PP_IF( \
1.1149 + BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
1.1150 + BOOST_PARAMETER_FN_ARG_NAME(elem) \
1.1151 + ) \
1.1152 + , (ParameterArgumentType ## i) \
1.1153 + , (const ParameterArgumentType ## i) \
1.1154 + ))
1.1155 +// No partial ordering. This feature doesn't work.
1.1156 +// This is exactly the same as for VC6.5, but we might change it later.
1.1157 +# else
1.1158 +# define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
1.1159 + (BOOST_PP_IF( \
1.1160 + BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
1.1161 + BOOST_PARAMETER_FN_ARG_NAME(elem) \
1.1162 + ) \
1.1163 + , (ParameterArgumentType ## i) \
1.1164 + , (const ParameterArgumentType ## i) \
1.1165 + ))
1.1166 +# endif
1.1167 +
1.1168 +# define BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
1.1169 + BOOST_PP_SEQ_FOR_EACH_I(BOOST_PARAMETER_FUNCTION_FWD_COMBINATION, ~, args)
1.1170 +
1.1171 +#endif // BOOST_PARAMETER_PREPROCESSOR_060206_HPP
1.1172 +