1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/parameter/macros.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,98 @@
1.4 +// Copyright David Abrahams, Daniel Wallin 2003. Use, modification and
1.5 +// distribution is subject to the Boost Software License, Version 1.0.
1.6 +// (See accompanying file LICENSE_1_0.txt or copy at
1.7 +// http://www.boost.org/LICENSE_1_0.txt)
1.8 +
1.9 +#ifndef BOOST_PARAMETER_MACROS_050412_HPP
1.10 +#define BOOST_PARAMETER_MACROS_050412_HPP
1.11 +
1.12 +#include <boost/preprocessor/tuple/elem.hpp>
1.13 +#include <boost/preprocessor/repetition/repeat_from_to.hpp>
1.14 +#include <boost/preprocessor/arithmetic/inc.hpp>
1.15 +#include <boost/preprocessor/logical/bool.hpp>
1.16 +#include <boost/preprocessor/punctuation/comma_if.hpp>
1.17 +#include <boost/preprocessor/control/expr_if.hpp>
1.18 +#include <boost/preprocessor/repetition/enum_params.hpp>
1.19 +#include <boost/preprocessor/repetition/enum_binary_params.hpp>
1.20 +#include <boost/preprocessor/cat.hpp>
1.21 +
1.22 +#define BOOST_PARAMETER_FUN_TEMPLATE_HEAD1(n) \
1.23 + template<BOOST_PP_ENUM_PARAMS(n, class T)>
1.24 +
1.25 +#define BOOST_PARAMETER_FUN_TEMPLATE_HEAD0(n)
1.26 +
1.27 +#ifndef BOOST_NO_SFINAE
1.28 +
1.29 +# define BOOST_PARAMETER_MATCH_TYPE(n, param) \
1.30 + BOOST_PP_EXPR_IF(n, typename) param::match \
1.31 + < \
1.32 + BOOST_PP_ENUM_PARAMS(n, T) \
1.33 + >::type
1.34 +
1.35 +#else
1.36 +
1.37 +# define BOOST_PARAMETER_MATCH_TYPE(n, param) param
1.38 +
1.39 +#endif
1.40 +
1.41 +#define BOOST_PARAMETER_FUN_DECL(z, n, params) \
1.42 + \
1.43 + BOOST_PP_CAT(BOOST_PARAMETER_FUN_TEMPLATE_HEAD, BOOST_PP_BOOL(n))(n) \
1.44 + \
1.45 + BOOST_PP_TUPLE_ELEM(3, 0, params) \
1.46 + BOOST_PP_TUPLE_ELEM(3, 1, params)( \
1.47 + BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& p) \
1.48 + BOOST_PP_COMMA_IF(n) \
1.49 + BOOST_PARAMETER_MATCH_TYPE(n,BOOST_PP_TUPLE_ELEM(3, 2, params)) \
1.50 + kw = BOOST_PP_TUPLE_ELEM(3, 2, params)() \
1.51 + ) \
1.52 + { \
1.53 + return BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 1, params), _with_named_params)( \
1.54 + kw(BOOST_PP_ENUM_PARAMS(n, p)) \
1.55 + ); \
1.56 + }
1.57 +
1.58 +// Generates:
1.59 +//
1.60 +// template<class Params>
1.61 +// ret name ## _with_named_params(Params const&);
1.62 +//
1.63 +// template<class T0>
1.64 +// ret name(T0 const& p0, typename parameters::match<T0>::type kw = parameters())
1.65 +// {
1.66 +// return name ## _with_named_params(kw(p0));
1.67 +// }
1.68 +//
1.69 +// template<class T0, ..., class TN>
1.70 +// ret name(T0 const& p0, ..., TN const& PN
1.71 +// , typename parameters::match<T0, ..., TN>::type kw = parameters())
1.72 +// {
1.73 +// return name ## _with_named_params(kw(p0, ..., pN));
1.74 +// }
1.75 +//
1.76 +// template<class Params>
1.77 +// ret name ## _with_named_params(Params const&)
1.78 +//
1.79 +// lo and hi determines the min and max arity of the generated functions.
1.80 +
1.81 +#define BOOST_PARAMETER_FUN(ret, name, lo, hi, parameters) \
1.82 + \
1.83 + template<class Params> \
1.84 + ret BOOST_PP_CAT(name, _with_named_params)(Params const& p); \
1.85 + \
1.86 + BOOST_PP_REPEAT_FROM_TO( \
1.87 + lo, BOOST_PP_INC(hi), BOOST_PARAMETER_FUN_DECL, (ret, name, parameters)) \
1.88 + \
1.89 + template<class Params> \
1.90 + ret BOOST_PP_CAT(name, _with_named_params)(Params const& p)
1.91 +
1.92 +#define BOOST_PARAMETER_MEMFUN(ret, name, lo, hi, parameters) \
1.93 + \
1.94 + BOOST_PP_REPEAT_FROM_TO( \
1.95 + lo, BOOST_PP_INC(hi), BOOST_PARAMETER_FUN_DECL, (ret, name, parameters)) \
1.96 + \
1.97 + template<class Params> \
1.98 + ret BOOST_PP_CAT(name, _with_named_params)(Params const& p)
1.99 +
1.100 +#endif // BOOST_PARAMETER_MACROS_050412_HPP
1.101 +