From 91b9020f9fdd612173b2c6d4a50d1caff14238bc Mon Sep 17 00:00:00 2001 From: Dexter Date: Wed, 30 Oct 2013 01:00:11 +0000 Subject: [PATCH] (part 2 oops..) fix for boost on gcc, #elif works differently (more correct) and breaks boost http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36453 the two .sh files got windows newlines, so fix those too while we're here note: should use an awk script for "#elif BOOST_PP" -> "#else if BOOST_PP" transform .. Conflicts: mp/src/thirdparty/boost/functional/overloaded_function.hpp mp/src/thirdparty/boost/functional/overloaded_function/detail/base.hpp mp/src/thirdparty/boost/local_function/aux_/function.hpp mp/src/thirdparty/boost/mpl/apply_wrap.hpp mp/src/thirdparty/boost/mpl/aux_/advance_backward.hpp mp/src/thirdparty/boost/mpl/aux_/advance_forward.hpp mp/src/thirdparty/boost/mpl/bind.hpp mp/src/thirdparty/boost/numeric/conversion/detail/numeric_cast_traits.hpp mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp mp/src/thirdparty/boost/variant/detail/substitute.hpp --- .../boost/functional/overloaded_function.hpp | 622 +++++----- .../overloaded_function/detail/base.hpp | 172 +-- .../boost/local_function/aux_/function.hpp | 660 +++++----- mp/src/thirdparty/boost/mpl/apply_wrap.hpp | 468 +++---- .../boost/mpl/aux_/advance_backward.hpp | 256 ++-- .../boost/mpl/aux_/advance_forward.hpp | 254 ++-- mp/src/thirdparty/boost/mpl/bind.hpp | 1102 ++++++++--------- .../conversion/detail/numeric_cast_traits.hpp | 276 ++--- .../thirdparty/boost/python/detail/target.hpp | 2 +- .../statement/detail/catch_all_eval.hpp | 202 +-- .../phoenix/statement/detail/catch_eval.hpp | 158 +-- .../boost/variant/detail/substitute.hpp | 462 +++---- 12 files changed, 2317 insertions(+), 2317 deletions(-) diff --git a/mp/src/thirdparty/boost/functional/overloaded_function.hpp b/mp/src/thirdparty/boost/functional/overloaded_function.hpp index 83fe4b38..d1e2b008 100644 --- a/mp/src/thirdparty/boost/functional/overloaded_function.hpp +++ b/mp/src/thirdparty/boost/functional/overloaded_function.hpp @@ -1,311 +1,311 @@ - -// Copyright (C) 2009-2012 Lorenzo Caminiti -// Distributed under the Boost Software License, Version 1.0 -// (see accompanying file LICENSE_1_0.txt or a copy at -// http://www.boost.org/LICENSE_1_0.txt) -// Home at http://www.boost.org/libs/functional/overloaded_function - -#ifndef DOXYGEN // Doxygen documentation only. - -#if !BOOST_PP_IS_ITERATING -# ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_ -# define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_ - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -#define BOOST_FUNCTIONAL_f_type(z, n, unused) \ - BOOST_PP_CAT(F, n) - -#define BOOST_FUNCTIONAL_f_arg(z, n, unused) \ - BOOST_PP_CAT(f, n) - -#define BOOST_FUNCTIONAL_f_tparam(z, n, unused) \ - typename BOOST_FUNCTIONAL_f_type(z, n, ~) \ - -#define BOOST_FUNCTIONAL_f_tparam_dflt(z, n, is_tspec) \ - BOOST_FUNCTIONAL_f_tparam(z, n, ~) \ - /* overload requires at least 2 functors so F0 and F1 not optional */ \ - BOOST_PP_EXPR_IIF(BOOST_PP_AND(BOOST_PP_NOT(is_tspec), \ - BOOST_PP_GREATER(n, 1)), \ - = void \ - ) - -#define BOOST_FUNCTIONAL_f_arg_decl(z, n, unused) \ - BOOST_FUNCTIONAL_f_type(z, n, ~) /* no qualifier to deduce tparam */ \ - BOOST_FUNCTIONAL_f_arg(z, n, ~) - -#define BOOST_FUNCTIONAL_g_type(z, n, unused) \ - BOOST_PP_CAT(G, n) - -#define BOOST_FUNCTIONAL_g_arg(z, n, unused) \ - BOOST_PP_CAT(g, n) - -#define BOOST_FUNCTIONAL_g_tparam(z, n, unused) \ - typename BOOST_FUNCTIONAL_g_type(z, n, ~) - -#define BOOST_FUNCTIONAL_g_arg_decl(z, n, unused) \ - BOOST_FUNCTIONAL_g_type(z, n, ~) /* no qualifier to deduce tparam */ \ - BOOST_FUNCTIONAL_g_arg(z, n, ~) - -#define BOOST_FUNCTIONAL_base(z, n, unused) \ - ::boost::overloaded_function_detail::base< \ - BOOST_FUNCTIONAL_f_type(z, n, ~) \ - > - -#define BOOST_FUNCTIONAL_inherit(z, n, unused) \ - public BOOST_FUNCTIONAL_base(z, n, ~) - -#define BOOST_FUNCTIONAL_base_init(z, n, unused) \ - BOOST_FUNCTIONAL_base(z, n, ~)(BOOST_FUNCTIONAL_g_arg(z, n, ~)) - -#define BOOST_FUNCTIONAL_using_operator_call(z, n, unused) \ - using BOOST_FUNCTIONAL_base(z, n, ~)::operator(); - -#define BOOST_FUNCTIONAL_function_type(z, n, unused) \ - typename ::boost::overloaded_function_detail::function_type< \ - BOOST_FUNCTIONAL_f_type(z, n, ~) \ - >::type - -# define BOOST_PP_ITERATION_PARAMS_1 \ - /* at least 2 func to overload so start from 2 to MAX */ \ - /* (cannot iterate [0, MAX-2) because error on Sun) */ \ - (3, (2, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ - "boost/functional/overloaded_function.hpp")) -# include BOOST_PP_ITERATE() // Iterate over function arity. - -#undef BOOST_FUNCTIONAL_f_type -#undef BOOST_FUNCTIONAL_f_arg -#undef BOOST_FUNCTIONAL_f_tparam -#undef BOOST_FUNCTIONAL_f_arg_decl -#undef BOOST_FUNCTIONAL_f_tparam_dflt -#undef BOOST_FUNCTIONAL_g_type -#undef BOOST_FUNCTIONAL_g_arg -#undef BOOST_FUNCTIONAL_g_tparam -#undef BOOST_FUNCTIONAL_g_arg_decl -#undef BOOST_FUNCTIONAL_base -#undef BOOST_FUNCTIONAL_inherit -#undef BOOST_FUNCTIONAL_base_init -#undef BOOST_FUNCTIONAL_using_operator_call -#undef BOOST_FUNCTIONAL_function_type - -# endif // #include guard - -#elif BOOST_PP_ITERATION_DEPTH() == 1 -# define BOOST_FUNCTIONAL_overloads \ - /* iterate as OVERLOADS, OVERLOADS-1, OVERLOADS-2, ... */ \ - /* (add 2 because iteration started from 2 to MAX) */ \ - BOOST_PP_ADD(2, BOOST_PP_SUB( \ - BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ - BOOST_PP_FRAME_ITERATION(1))) -# define BOOST_FUNCTIONAL_is_tspec \ - /* if template specialization */ \ - BOOST_PP_LESS(BOOST_FUNCTIONAL_overloads, \ - BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX) - -// For type-of emulation: This must be included at this pp iteration level. -# include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() - -namespace boost { - -template< - BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam_dflt, - BOOST_FUNCTIONAL_is_tspec) -> -class overloaded_function - // Template specialization. - BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), <) - BOOST_PP_IIF(BOOST_FUNCTIONAL_is_tspec, - BOOST_PP_ENUM - , - BOOST_PP_TUPLE_EAT(3) - )(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_type, ~) - BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), >) - // Bases (overloads >= 2 so always at least 2 bases). - : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, - BOOST_FUNCTIONAL_inherit, ~) -{ -public: - template< - BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_g_tparam, ~) - > /* implicit */ inline overloaded_function( - BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, - BOOST_FUNCTIONAL_g_arg_decl, ~)) - // Overloads >= 2 so always at least 2 bases to initialize. - : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, - BOOST_FUNCTIONAL_base_init, ~) - {} - - BOOST_PP_REPEAT(BOOST_FUNCTIONAL_overloads, - BOOST_FUNCTIONAL_using_operator_call, ~) -}; - -template< - BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam, ~) -> -overloaded_function< - BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_function_type, ~) -> make_overloaded_function( - BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg_decl, ~) -) { - return overloaded_function< - BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, - BOOST_FUNCTIONAL_function_type, ~) - >(BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg, ~)); -} - -} // namespace - -// For type-of emulation: Register overloaded function type (for _AUTO, etc). -BOOST_TYPEOF_REGISTER_TEMPLATE(boost::overloaded_function, - BOOST_FUNCTIONAL_overloads) - -# undef BOOST_FUNCTIONAL_overloads -# undef BOOST_FUNCTIONAL_is_tspec -#endif // iteration - -// DOCUMENTATION // - -#else // DOXYGEN - -/** @file -@brief Overload distinct function pointers, function references, and -monomorphic function objects into a single function object. -*/ - -namespace boost { - -/** -@brief Function object to overload functions with distinct signatures. - -This function object aggregates together calls to functions of all the -specified function types F1, F2, etc which must have distinct -function signatures from one another. - -@Params -@Param{Fi, -Each function type must be specified using the following syntax (which is -Boost.Function's preferred syntax): -@code - result_type (argument1_type\, argumgnet2_type\, ...) -@endcode -} -@EndParams - -In some cases, the @RefFunc{make_overloaded_function} function template can be -useful to construct an overloaded function object without explicitly -specifying the function types. - -At least two distinct function types must be specified (because there is -nothing to overload between one or zero functions). -The maximum number of functions to overload is given by the -@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX} -configuration macro. -The maximum number of function parameters for each of the specified function -types is given by the -@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX} -configuration macro. - -@See @RefSect{tutorial, Tutorial} section, @RefFunc{make_overloaded_function}, -@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}, -@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX}, -Boost.Function. -*/ -template -class overloaded_function { -public: - /** - @brief Construct the overloaded function object. - - Any function pointer, function reference, and monomorphic function object - that can be converted to a boost::function function object can be - specified as parameter. - - @Note Unfortunately, it is not possible to support polymorphic function - objects (as explained here). - */ - overloaded_function(const boost::function&, - const boost::function&, ...); - - /** - @brief Call operator matching the signature of the function type specified - as 1st template parameter. - - This will in turn invoke the call operator of the 1st function passed to - the constructor. - */ - typename boost::function_traits::result_type operator()( - typename boost::function_traits::arg1_type, - typename boost::function_traits::arg2_type, - ...) const; - - /** - @brief Call operator matching the signature of the function type specified - as 2nd template parameter. - - This will in turn invoke the call operator of the 2nd function passed to - the constructor. - - @Note Similar call operators are present for all specified function types - F1, F2, etc (even if not exhaustively listed by this - documentation). - */ - typename boost::function_traits::result_type operator()( - typename boost::function_traits::arg1_type, - typename boost::function_traits::arg2_type, - ...) const; -}; - -/** -@brief Make an overloaded function object without explicitly specifying the -function types. - -This function template creates and returns an @RefClass{overloaded_function} -object that overloads all the specified functions f1, f2, etc. - -The function types are internally determined from the template parameter types -so they do not need to be explicitly specified. -Therefore, this function template usually has a more concise syntax when -compared with @RefClass{overloaded_function}. -This is especially useful when the explicit type of the returned -@RefClass{overloaded_function} object does not need to be known (e.g., when -used with Boost.Typeof's BOOST_AUTO, C++11 auto, or when the -overloaded function object is handled using a function template parameter, see -the @RefSect{tutorial, Tutorial} section). - -The maximum number of functions to overload is given by the -@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX} -configuration macro. - -@Note In this documentation, __function_type__ is a placeholder for a -symbol that is specific to the implementation of this library. - -@See @RefSect{tutorial, Tutorial} section, @RefClass{overloaded_function}, -@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}. -*/ -template -overloaded_function< - __function_type__, __function_type__, ... -> make_overloaded_function(F1 f1, F2 f2, ...); - -} // namespace - -#endif // DOXYGEN - + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/functional/overloaded_function + +#ifndef DOXYGEN // Doxygen documentation only. + +#if !BOOST_PP_IS_ITERATING +# ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_ +# define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +#define BOOST_FUNCTIONAL_f_type(z, n, unused) \ + BOOST_PP_CAT(F, n) + +#define BOOST_FUNCTIONAL_f_arg(z, n, unused) \ + BOOST_PP_CAT(f, n) + +#define BOOST_FUNCTIONAL_f_tparam(z, n, unused) \ + typename BOOST_FUNCTIONAL_f_type(z, n, ~) \ + +#define BOOST_FUNCTIONAL_f_tparam_dflt(z, n, is_tspec) \ + BOOST_FUNCTIONAL_f_tparam(z, n, ~) \ + /* overload requires at least 2 functors so F0 and F1 not optional */ \ + BOOST_PP_EXPR_IIF(BOOST_PP_AND(BOOST_PP_NOT(is_tspec), \ + BOOST_PP_GREATER(n, 1)), \ + = void \ + ) + +#define BOOST_FUNCTIONAL_f_arg_decl(z, n, unused) \ + BOOST_FUNCTIONAL_f_type(z, n, ~) /* no qualifier to deduce tparam */ \ + BOOST_FUNCTIONAL_f_arg(z, n, ~) + +#define BOOST_FUNCTIONAL_g_type(z, n, unused) \ + BOOST_PP_CAT(G, n) + +#define BOOST_FUNCTIONAL_g_arg(z, n, unused) \ + BOOST_PP_CAT(g, n) + +#define BOOST_FUNCTIONAL_g_tparam(z, n, unused) \ + typename BOOST_FUNCTIONAL_g_type(z, n, ~) + +#define BOOST_FUNCTIONAL_g_arg_decl(z, n, unused) \ + BOOST_FUNCTIONAL_g_type(z, n, ~) /* no qualifier to deduce tparam */ \ + BOOST_FUNCTIONAL_g_arg(z, n, ~) + +#define BOOST_FUNCTIONAL_base(z, n, unused) \ + ::boost::overloaded_function_detail::base< \ + BOOST_FUNCTIONAL_f_type(z, n, ~) \ + > + +#define BOOST_FUNCTIONAL_inherit(z, n, unused) \ + public BOOST_FUNCTIONAL_base(z, n, ~) + +#define BOOST_FUNCTIONAL_base_init(z, n, unused) \ + BOOST_FUNCTIONAL_base(z, n, ~)(BOOST_FUNCTIONAL_g_arg(z, n, ~)) + +#define BOOST_FUNCTIONAL_using_operator_call(z, n, unused) \ + using BOOST_FUNCTIONAL_base(z, n, ~)::operator(); + +#define BOOST_FUNCTIONAL_function_type(z, n, unused) \ + typename ::boost::overloaded_function_detail::function_type< \ + BOOST_FUNCTIONAL_f_type(z, n, ~) \ + >::type + +# define BOOST_PP_ITERATION_PARAMS_1 \ + /* at least 2 func to overload so start from 2 to MAX */ \ + /* (cannot iterate [0, MAX-2) because error on Sun) */ \ + (3, (2, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ + "boost/functional/overloaded_function.hpp")) +# include BOOST_PP_ITERATE() // Iterate over function arity. + +#undef BOOST_FUNCTIONAL_f_type +#undef BOOST_FUNCTIONAL_f_arg +#undef BOOST_FUNCTIONAL_f_tparam +#undef BOOST_FUNCTIONAL_f_arg_decl +#undef BOOST_FUNCTIONAL_f_tparam_dflt +#undef BOOST_FUNCTIONAL_g_type +#undef BOOST_FUNCTIONAL_g_arg +#undef BOOST_FUNCTIONAL_g_tparam +#undef BOOST_FUNCTIONAL_g_arg_decl +#undef BOOST_FUNCTIONAL_base +#undef BOOST_FUNCTIONAL_inherit +#undef BOOST_FUNCTIONAL_base_init +#undef BOOST_FUNCTIONAL_using_operator_call +#undef BOOST_FUNCTIONAL_function_type + +# endif // #include guard + +#else if BOOST_PP_ITERATION_DEPTH() == 1 +# define BOOST_FUNCTIONAL_overloads \ + /* iterate as OVERLOADS, OVERLOADS-1, OVERLOADS-2, ... */ \ + /* (add 2 because iteration started from 2 to MAX) */ \ + BOOST_PP_ADD(2, BOOST_PP_SUB( \ + BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ + BOOST_PP_FRAME_ITERATION(1))) +# define BOOST_FUNCTIONAL_is_tspec \ + /* if template specialization */ \ + BOOST_PP_LESS(BOOST_FUNCTIONAL_overloads, \ + BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX) + +// For type-of emulation: This must be included at this pp iteration level. +# include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() + +namespace boost { + +template< + BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam_dflt, + BOOST_FUNCTIONAL_is_tspec) +> +class overloaded_function + // Template specialization. + BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), <) + BOOST_PP_IIF(BOOST_FUNCTIONAL_is_tspec, + BOOST_PP_ENUM + , + BOOST_PP_TUPLE_EAT(3) + )(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_type, ~) + BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), >) + // Bases (overloads >= 2 so always at least 2 bases). + : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, + BOOST_FUNCTIONAL_inherit, ~) +{ +public: + template< + BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_g_tparam, ~) + > /* implicit */ inline overloaded_function( + BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, + BOOST_FUNCTIONAL_g_arg_decl, ~)) + // Overloads >= 2 so always at least 2 bases to initialize. + : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, + BOOST_FUNCTIONAL_base_init, ~) + {} + + BOOST_PP_REPEAT(BOOST_FUNCTIONAL_overloads, + BOOST_FUNCTIONAL_using_operator_call, ~) +}; + +template< + BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam, ~) +> +overloaded_function< + BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_function_type, ~) +> make_overloaded_function( + BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg_decl, ~) +) { + return overloaded_function< + BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, + BOOST_FUNCTIONAL_function_type, ~) + >(BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg, ~)); +} + +} // namespace + +// For type-of emulation: Register overloaded function type (for _AUTO, etc). +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::overloaded_function, + BOOST_FUNCTIONAL_overloads) + +# undef BOOST_FUNCTIONAL_overloads +# undef BOOST_FUNCTIONAL_is_tspec +#endif // iteration + +// DOCUMENTATION // + +#else // DOXYGEN + +/** @file +@brief Overload distinct function pointers, function references, and +monomorphic function objects into a single function object. +*/ + +namespace boost { + +/** +@brief Function object to overload functions with distinct signatures. + +This function object aggregates together calls to functions of all the +specified function types F1, F2, etc which must have distinct +function signatures from one another. + +@Params +@Param{Fi, +Each function type must be specified using the following syntax (which is +Boost.Function's preferred syntax): +@code + result_type (argument1_type\, argumgnet2_type\, ...) +@endcode +} +@EndParams + +In some cases, the @RefFunc{make_overloaded_function} function template can be +useful to construct an overloaded function object without explicitly +specifying the function types. + +At least two distinct function types must be specified (because there is +nothing to overload between one or zero functions). +The maximum number of functions to overload is given by the +@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX} +configuration macro. +The maximum number of function parameters for each of the specified function +types is given by the +@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX} +configuration macro. + +@See @RefSect{tutorial, Tutorial} section, @RefFunc{make_overloaded_function}, +@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}, +@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX}, +Boost.Function. +*/ +template +class overloaded_function { +public: + /** + @brief Construct the overloaded function object. + + Any function pointer, function reference, and monomorphic function object + that can be converted to a boost::function function object can be + specified as parameter. + + @Note Unfortunately, it is not possible to support polymorphic function + objects (as explained here). + */ + overloaded_function(const boost::function&, + const boost::function&, ...); + + /** + @brief Call operator matching the signature of the function type specified + as 1st template parameter. + + This will in turn invoke the call operator of the 1st function passed to + the constructor. + */ + typename boost::function_traits::result_type operator()( + typename boost::function_traits::arg1_type, + typename boost::function_traits::arg2_type, + ...) const; + + /** + @brief Call operator matching the signature of the function type specified + as 2nd template parameter. + + This will in turn invoke the call operator of the 2nd function passed to + the constructor. + + @Note Similar call operators are present for all specified function types + F1, F2, etc (even if not exhaustively listed by this + documentation). + */ + typename boost::function_traits::result_type operator()( + typename boost::function_traits::arg1_type, + typename boost::function_traits::arg2_type, + ...) const; +}; + +/** +@brief Make an overloaded function object without explicitly specifying the +function types. + +This function template creates and returns an @RefClass{overloaded_function} +object that overloads all the specified functions f1, f2, etc. + +The function types are internally determined from the template parameter types +so they do not need to be explicitly specified. +Therefore, this function template usually has a more concise syntax when +compared with @RefClass{overloaded_function}. +This is especially useful when the explicit type of the returned +@RefClass{overloaded_function} object does not need to be known (e.g., when +used with Boost.Typeof's BOOST_AUTO, C++11 auto, or when the +overloaded function object is handled using a function template parameter, see +the @RefSect{tutorial, Tutorial} section). + +The maximum number of functions to overload is given by the +@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX} +configuration macro. + +@Note In this documentation, __function_type__ is a placeholder for a +symbol that is specific to the implementation of this library. + +@See @RefSect{tutorial, Tutorial} section, @RefClass{overloaded_function}, +@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}. +*/ +template +overloaded_function< + __function_type__, __function_type__, ... +> make_overloaded_function(F1 f1, F2 f2, ...); + +} // namespace + +#endif // DOXYGEN + diff --git a/mp/src/thirdparty/boost/functional/overloaded_function/detail/base.hpp b/mp/src/thirdparty/boost/functional/overloaded_function/detail/base.hpp index 8fd9a0a2..9838b4d2 100644 --- a/mp/src/thirdparty/boost/functional/overloaded_function/detail/base.hpp +++ b/mp/src/thirdparty/boost/functional/overloaded_function/detail/base.hpp @@ -1,86 +1,86 @@ - -// Copyright (C) 2009-2012 Lorenzo Caminiti -// Distributed under the Boost Software License, Version 1.0 -// (see accompanying file LICENSE_1_0.txt or a copy at -// http://www.boost.org/LICENSE_1_0.txt) -// Home at http://www.boost.org/libs/functional/overloaded_function - -#if !BOOST_PP_IS_ITERATING -# ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_ -# define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_ - -# include -# include -# include -# include -# include -# include - -#define BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \ - BOOST_PP_CAT(A, n) - -#define BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) \ - BOOST_PP_CAT(a, n) - -#define BOOST_FUNCTIONAL_DETAIL_arg_tparam(z, n, unused) \ - typename BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) - -#define BOOST_FUNCTIONAL_DETAIL_arg(z, n, unused) \ - BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \ - BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) - -#define BOOST_FUNCTIONAL_DETAIL_f \ - R (BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, \ - BOOST_FUNCTIONAL_DETAIL_arg_type, ~)) - -// Do not use namespace ::detail because overloaded_function is already a class. -namespace boost { namespace overloaded_function_detail { - -template -class base {}; // Empty template cannot be used directly (only its spec). - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \ - "boost/functional/overloaded_function/detail/base.hpp")) -# include BOOST_PP_ITERATE() // Iterate over funciton arity. - -} } // namespace - -#undef BOOST_FUNCTIONAL_DETAIL_arg_type -#undef BOOST_FUNCTIONAL_DETAIL_arg_name -#undef BOOST_FUNCTIONAL_DETAIL_arg_tparam -#undef BOOST_FUNCTIONAL_DETAIL_arg -#undef BOOST_FUNCTIONAL_DETAIL_f - -# endif // #include guard - -#elif BOOST_PP_ITERATION_DEPTH() == 1 -# define BOOST_FUNCTIONAL_DETAIL_arity BOOST_PP_FRAME_ITERATION(1) - -template< - typename R - BOOST_PP_COMMA_IF(BOOST_FUNCTIONAL_DETAIL_arity) - BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, - BOOST_FUNCTIONAL_DETAIL_arg_tparam, ~) -> -class base< BOOST_FUNCTIONAL_DETAIL_f > { -public: - /* implicit */ inline base( - // This requires specified type to be implicitly convertible to - // a boost::function<> functor. - boost::function< BOOST_FUNCTIONAL_DETAIL_f > const& f): f_(f) - {} - - inline R operator()(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, - BOOST_FUNCTIONAL_DETAIL_arg, ~)) const { - return f_(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, - BOOST_FUNCTIONAL_DETAIL_arg_name, ~)); - } - -private: - boost::function< BOOST_FUNCTIONAL_DETAIL_f > const f_; -}; - -# undef BOOST_FUNCTIONAL_DETAIL_arity -#endif // iteration - + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/functional/overloaded_function + +#if !BOOST_PP_IS_ITERATING +# ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_ +# define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_ + +# include +# include +# include +# include +# include +# include + +#define BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \ + BOOST_PP_CAT(A, n) + +#define BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) \ + BOOST_PP_CAT(a, n) + +#define BOOST_FUNCTIONAL_DETAIL_arg_tparam(z, n, unused) \ + typename BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) + +#define BOOST_FUNCTIONAL_DETAIL_arg(z, n, unused) \ + BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \ + BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) + +#define BOOST_FUNCTIONAL_DETAIL_f \ + R (BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, \ + BOOST_FUNCTIONAL_DETAIL_arg_type, ~)) + +// Do not use namespace ::detail because overloaded_function is already a class. +namespace boost { namespace overloaded_function_detail { + +template +class base {}; // Empty template cannot be used directly (only its spec). + +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \ + "boost/functional/overloaded_function/detail/base.hpp")) +# include BOOST_PP_ITERATE() // Iterate over funciton arity. + +} } // namespace + +#undef BOOST_FUNCTIONAL_DETAIL_arg_type +#undef BOOST_FUNCTIONAL_DETAIL_arg_name +#undef BOOST_FUNCTIONAL_DETAIL_arg_tparam +#undef BOOST_FUNCTIONAL_DETAIL_arg +#undef BOOST_FUNCTIONAL_DETAIL_f + +# endif // #include guard + +#else if BOOST_PP_ITERATION_DEPTH() == 1 +# define BOOST_FUNCTIONAL_DETAIL_arity BOOST_PP_FRAME_ITERATION(1) + +template< + typename R + BOOST_PP_COMMA_IF(BOOST_FUNCTIONAL_DETAIL_arity) + BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, + BOOST_FUNCTIONAL_DETAIL_arg_tparam, ~) +> +class base< BOOST_FUNCTIONAL_DETAIL_f > { +public: + /* implicit */ inline base( + // This requires specified type to be implicitly convertible to + // a boost::function<> functor. + boost::function< BOOST_FUNCTIONAL_DETAIL_f > const& f): f_(f) + {} + + inline R operator()(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, + BOOST_FUNCTIONAL_DETAIL_arg, ~)) const { + return f_(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, + BOOST_FUNCTIONAL_DETAIL_arg_name, ~)); + } + +private: + boost::function< BOOST_FUNCTIONAL_DETAIL_f > const f_; +}; + +# undef BOOST_FUNCTIONAL_DETAIL_arity +#endif // iteration + diff --git a/mp/src/thirdparty/boost/local_function/aux_/function.hpp b/mp/src/thirdparty/boost/local_function/aux_/function.hpp index e6de9397..30a89190 100644 --- a/mp/src/thirdparty/boost/local_function/aux_/function.hpp +++ b/mp/src/thirdparty/boost/local_function/aux_/function.hpp @@ -1,330 +1,330 @@ - -// Copyright (C) 2009-2012 Lorenzo Caminiti -// Distributed under the Boost Software License, Version 1.0 -// (see accompanying file LICENSE_1_0.txt or a copy at -// http://www.boost.org/LICENSE_1_0.txt) -// Home at http://www.boost.org/libs/local_function - -#if !BOOST_PP_IS_ITERATING -# ifndef BOOST_LOCAL_FUNCTION_AUX_FUNCTION_HPP_ -# define BOOST_LOCAL_FUNCTION_AUX_FUNCTION_HPP_ - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -// PRIVATE // - -#define BOOST_LOCAL_FUNCTION_AUX_FUNCTION_THIS_FILE_ \ - "boost/local_function/aux_/function.hpp" - -// PUBLIC // - -#define BOOST_LOCAL_FUNCTION_AUX_FUNCTION_INIT_CALL_FUNC \ - BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (init_call) ) - -#define BOOST_LOCAL_FUNCTION_AUX_typename_seq(z, n, unused) \ - (typename) - -#define BOOST_LOCAL_FUNCTION_AUX_arg_type(z, arg_n, unused) \ - BOOST_PP_CAT(Arg, arg_n) - -#define BOOST_LOCAL_FUNCTION_AUX_arg_typedef(z, arg_n, unused) \ - typedef \ - BOOST_LOCAL_FUNCTION_AUX_arg_type(z, arg_n, ~) \ - /* name must follow Boost.FunctionTraits arg1_type, arg2_type, ... */ \ - BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(arg_n)), _type) \ - ; - -#define BOOST_LOCAL_FUNCTION_AUX_comma_arg_tparam(z, arg_n, unused) \ - , typename BOOST_LOCAL_FUNCTION_AUX_arg_type(z, arg_n, ~) - -#define BOOST_LOCAL_FUNCTION_AUX_arg_param_type(z, arg_n, comma01) \ - BOOST_PP_COMMA_IF(comma01) \ - typename ::boost::call_traits< \ - BOOST_LOCAL_FUNCTION_AUX_arg_type(z, arg_n, ~) \ - >::param_type - -#define BOOST_LOCAL_FUNCTION_AUX_arg_name(z, arg_n, comma01) \ - BOOST_PP_COMMA_IF(comma01) \ - BOOST_PP_CAT(arg, arg_n) - -#define BOOST_LOCAL_FUNCTION_AUX_arg_param_decl(z, arg_n, unused) \ - BOOST_LOCAL_FUNCTION_AUX_arg_param_type(z, arg_n, 0 /* no leading comma */)\ - BOOST_LOCAL_FUNCTION_AUX_arg_name(z, arg_n, 0 /* no leading comma */) - -#define BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, unused) \ - BOOST_PP_CAT(Bind, bind_n) - -#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_type(z, bind_n, unused) \ - , BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) - -#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_ref(z, bind_n, unused) \ - , BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) & - -#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam(z, bind_n, unused) \ - , typename BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) - -#define BOOST_LOCAL_FUNCTION_AUX_bind_name(z, bind_n, unused) \ - BOOST_PP_CAT(bing, bind_n) - -#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_param_decl(z, bind_n, unused) \ - , \ - BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) & \ - BOOST_LOCAL_FUNCTION_AUX_bind_name(z, bind_n, ~) - -#define BOOST_LOCAL_FUNCTION_AUX_bind_member(z, bind_n, unsued) \ - BOOST_PP_CAT(BOOST_LOCAL_FUNCTION_AUX_bind_name(z, bind_n, ~), _) - -#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_member_deref(z, bind_n, unsued) \ - , member_deref< BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) >( \ - BOOST_LOCAL_FUNCTION_AUX_bind_member(z, bind_n, ~)) - -#define BOOST_LOCAL_FUNCTION_AUX_bind_member_init(z, bind_n, unused) \ - BOOST_LOCAL_FUNCTION_AUX_bind_member(z, bind_n, ~) = member_addr( \ - BOOST_LOCAL_FUNCTION_AUX_bind_name(z, bind_n, ~)); - -#define BOOST_LOCAL_FUNCTION_AUX_bind_member_decl(z, bind_n, unused) \ - /* must be ptr (not ref) so can use default constr */ \ - typename member_type< \ - BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) \ - >::pointer BOOST_LOCAL_FUNCTION_AUX_bind_member(z, bind_n, ~) ; - -#define BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, unused) \ - BOOST_PP_CAT(call_ptr, n) - -#define BOOST_LOCAL_FUNCTION_AUX_call_name(z, n, unused) \ - BOOST_PP_CAT(call, n) - -#define BOOST_LOCAL_FUNCTION_AUX_call_member(z, n, unused) \ - BOOST_PP_CAT(BOOST_LOCAL_FUNCTION_AUX_call_name(z, n, unused), _) - -#define BOOST_LOCAL_FUNCTION_AUX_call_typedef(z, n, arity) \ - typedef R (*BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, ~))( \ - object_ptr \ - BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS, \ - BOOST_PP_TUPLE_EAT(3) \ - , \ - BOOST_PP_REPEAT_ ## z \ - )(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, \ - BOOST_LOCAL_FUNCTION_AUX_comma_bind_ref, ~) \ - BOOST_PP_REPEAT_ ## z(BOOST_PP_SUB(arity, n), \ - BOOST_LOCAL_FUNCTION_AUX_arg_param_type, 1 /* leading comma */)\ - ); - -#define BOOST_LOCAL_FUNCTION_AUX_comma_call_param_decl(z, n, unused) \ - , \ - BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, ~) \ - BOOST_LOCAL_FUNCTION_AUX_call_name(z, n, ~) - -#define BOOST_LOCAL_FUNCTION_AUX_call_decl(z, n, unused) \ - BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, ~) \ - BOOST_LOCAL_FUNCTION_AUX_call_member(z, n, ~); - -#define BOOST_LOCAL_FUNCTION_AUX_call_init(z, n, unused) \ - BOOST_LOCAL_FUNCTION_AUX_call_member(z, n, ~) = \ - BOOST_LOCAL_FUNCTION_AUX_call_name(z, n, ~); - -#define BOOST_LOCAL_FUNCTION_AUX_operator_call(z, defaults_n, arity) \ - /* precondition: object_ && call_function_ */ \ - inline R operator()( \ - BOOST_PP_ENUM_ ## z(BOOST_PP_SUB(arity, defaults_n), \ - BOOST_LOCAL_FUNCTION_AUX_arg_param_decl, ~) \ - ) /* cannot be const because of binds (same as for local ftor) */ { \ - /* run-time: do not assert preconditions here for efficiency */ \ - /* run-time: this function call is done via a function pointer */ \ - /* so unfortunately does not allow for compiler inlining */ \ - /* optimizations (an alternative using virtual function was also */ \ - /* investigated but also virtual functions cannot be optimized */ \ - /* plus they require virtual table lookups to the alternative */ \ - /* performed worst) */ \ - return BOOST_LOCAL_FUNCTION_AUX_call_member(z, defaults_n, ~)( \ - object_ \ - BOOST_PP_IIF( \ - BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS,\ - BOOST_PP_TUPLE_EAT(3) \ - , \ - BOOST_PP_REPEAT_ ## z \ - )(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, \ - BOOST_LOCAL_FUNCTION_AUX_comma_bind_member_deref, ~) \ - BOOST_PP_REPEAT_ ## z(BOOST_PP_SUB(arity, defaults_n), \ - BOOST_LOCAL_FUNCTION_AUX_arg_name, 1 /* leading comma */) \ - ); \ - } - -namespace boost { namespace local_function { namespace aux { - -template< - typename F - , size_t defaults -#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS - BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, - BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam, ~) -#endif -> -class function {}; // Empty template, only use its specializations. - -// Iterate within namespace. -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_LOCAL_FUNCTION_CONFIG_FUNCTION_ARITY_MAX, \ - BOOST_LOCAL_FUNCTION_AUX_FUNCTION_THIS_FILE_)) -# include BOOST_PP_ITERATE() // Iterate over function arity. - -} } } // namespace - -// Register type for type-of emu (NAME use TYPEOF to deduce this fctor type). -#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() -BOOST_TYPEOF_REGISTER_TEMPLATE(boost::local_function::aux::function, - (typename) // For `F` tparam. - (size_t) // For `defaults` tparam. - // MSVC error if using #if instead of PP_IIF here. - BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS, - BOOST_PP_TUPLE_EAT(3) // Nothing. - , - BOOST_PP_REPEAT // For bind tparams. - )(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, - BOOST_LOCAL_FUNCTION_AUX_typename_seq, ~) -) - -#undef BOOST_LOCAL_FUNCTION_AUX_typename_seq -#undef BOOST_LOCAL_FUNCTION_AUX_arg_type -#undef BOOST_LOCAL_FUNCTION_AUX_arg_typedef -#undef BOOST_LOCAL_FUNCTION_AUX_comma_arg_tparam -#undef BOOST_LOCAL_FUNCTION_AUX_arg_param_type -#undef BOOST_LOCAL_FUNCTION_AUX_arg_name -#undef BOOST_LOCAL_FUNCTION_AUX_arg_param_decl -#undef BOOST_LOCAL_FUNCTION_AUX_bind_type -#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_type -#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_ref -#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam -#undef BOOST_LOCAL_FUNCTION_AUX_bind_name -#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_param_decl -#undef BOOST_LOCAL_FUNCTION_AUX_bind_member -#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_member_deref -#undef BOOST_LOCAL_FUNCTION_AUX_bind_member_init -#undef BOOST_LOCAL_FUNCTION_AUX_bind_member_decl -#undef BOOST_LOCAL_FUNCTION_AUX_call_ptr -#undef BOOST_LOCAL_FUNCTION_AUX_call_name -#undef BOOST_LOCAL_FUNCTION_AUX_call_member -#undef BOOST_LOCAL_FUNCTION_AUX_call_typedef -#undef BOOST_LOCAL_FUNCTION_AUX_comma_call_param_decl -#undef BOOST_LOCAL_FUNCTION_AUX_call_decl -#undef BOOST_LOCAL_FUNCTION_AUX_call_init -#undef BOOST_LOCAL_FUNCTION_AUX_operator_call - -# endif // #include guard - -#elif BOOST_PP_ITERATION_DEPTH() == 1 -# define BOOST_LOCAL_FUNCTION_AUX_arity BOOST_PP_FRAME_ITERATION(1) -# define BOOST_PP_ITERATION_PARAMS_2 \ - (3, (0, BOOST_LOCAL_FUNCTION_AUX_arity, \ - BOOST_LOCAL_FUNCTION_AUX_FUNCTION_THIS_FILE_)) -# include BOOST_PP_ITERATE() // Iterate over default params count. -# undef BOOST_LOCAL_FUNCTION_AUX_arity - -#elif BOOST_PP_ITERATION_DEPTH() == 2 -# define BOOST_LOCAL_FUNCTION_AUX_defaults BOOST_PP_FRAME_ITERATION(2) - -template< - typename R - BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_AUX_arity, - BOOST_LOCAL_FUNCTION_AUX_comma_arg_tparam, ~) -#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS - BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, - BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam, ~) -#endif -> -class function< - R ( - BOOST_PP_ENUM(BOOST_LOCAL_FUNCTION_AUX_arity, - BOOST_LOCAL_FUNCTION_AUX_arg_type, ~) - ) - , BOOST_LOCAL_FUNCTION_AUX_defaults -#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS - BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, - BOOST_LOCAL_FUNCTION_AUX_comma_bind_type, ~) -#endif -> { - // The object type will actually be a local class which cannot be passed as - // a template parameter so a generic `void*` pointer is used to hold the - // object (this pointer will then be cased by the call-function implemented - // by the local class itself). This is the trick used to pass a local - // function as a template parameter. This trick uses function pointers for - // the call-functions and function pointers cannot always be optimized by - // the compiler (they cannot be inlined) thus this trick increased run-time - // (another trick using virtual functions for the local class was also - // investigated but also virtual functions cannot be inlined plus they - // require virtual tables lookups so the virtual functions trick measured - // worst run-time performance than the function pointer trick). - typedef void* object_ptr; - BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), - BOOST_LOCAL_FUNCTION_AUX_call_typedef, // INC for no defaults. - BOOST_LOCAL_FUNCTION_AUX_arity) - -public: - // Provide public type interface following Boost.Function names - // (traits must be defined in both this and the local functor). - BOOST_STATIC_CONSTANT(size_t, arity = BOOST_LOCAL_FUNCTION_AUX_arity); - typedef R result_type; - BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_AUX_arity, - BOOST_LOCAL_FUNCTION_AUX_arg_typedef, ~) - - // NOTE: Must have default constructor for init without function name in - // function macro expansion. - - // Cannot be private but it should never be used by programmers directly - // so used internal symbol. - inline void BOOST_LOCAL_FUNCTION_AUX_FUNCTION_INIT_CALL_FUNC( - object_ptr object -#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS - BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, - BOOST_LOCAL_FUNCTION_AUX_comma_bind_param_decl, ~) -#endif - BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), - BOOST_LOCAL_FUNCTION_AUX_comma_call_param_decl, ~) - ) { - object_ = object; -#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS - BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, - BOOST_LOCAL_FUNCTION_AUX_bind_member_init, ~) -#endif - BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), - BOOST_LOCAL_FUNCTION_AUX_call_init, ~) // INC for no defaults. - unused_ = 0; // To avoid a GCC uninitialized warning. - } - - // Result operator(Arg1, ..., ArgN-1, ArgN) -- iff defaults >= 0 - // Result operator(Arg1, ..., ArgN-1) -- iff defaults >= 1 - // ... -- etc - BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), - BOOST_LOCAL_FUNCTION_AUX_operator_call, // INC for no defaults. - BOOST_LOCAL_FUNCTION_AUX_arity) - -private: - object_ptr object_; -#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS - BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, - BOOST_LOCAL_FUNCTION_AUX_bind_member_decl, ~) -#endif - BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), - BOOST_LOCAL_FUNCTION_AUX_call_decl, ~) // INC for no defaults. - - // run-time: this unused void* member variable allows for compiler - // optimizations (at least on MSVC it reduces invocation time of about 50%) - void* unused_; -}; - -# undef BOOST_LOCAL_FUNCTION_AUX_defaults -#endif // iteration - + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#if !BOOST_PP_IS_ITERATING +# ifndef BOOST_LOCAL_FUNCTION_AUX_FUNCTION_HPP_ +# define BOOST_LOCAL_FUNCTION_AUX_FUNCTION_HPP_ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_AUX_FUNCTION_THIS_FILE_ \ + "boost/local_function/aux_/function.hpp" + +// PUBLIC // + +#define BOOST_LOCAL_FUNCTION_AUX_FUNCTION_INIT_CALL_FUNC \ + BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (init_call) ) + +#define BOOST_LOCAL_FUNCTION_AUX_typename_seq(z, n, unused) \ + (typename) + +#define BOOST_LOCAL_FUNCTION_AUX_arg_type(z, arg_n, unused) \ + BOOST_PP_CAT(Arg, arg_n) + +#define BOOST_LOCAL_FUNCTION_AUX_arg_typedef(z, arg_n, unused) \ + typedef \ + BOOST_LOCAL_FUNCTION_AUX_arg_type(z, arg_n, ~) \ + /* name must follow Boost.FunctionTraits arg1_type, arg2_type, ... */ \ + BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(arg_n)), _type) \ + ; + +#define BOOST_LOCAL_FUNCTION_AUX_comma_arg_tparam(z, arg_n, unused) \ + , typename BOOST_LOCAL_FUNCTION_AUX_arg_type(z, arg_n, ~) + +#define BOOST_LOCAL_FUNCTION_AUX_arg_param_type(z, arg_n, comma01) \ + BOOST_PP_COMMA_IF(comma01) \ + typename ::boost::call_traits< \ + BOOST_LOCAL_FUNCTION_AUX_arg_type(z, arg_n, ~) \ + >::param_type + +#define BOOST_LOCAL_FUNCTION_AUX_arg_name(z, arg_n, comma01) \ + BOOST_PP_COMMA_IF(comma01) \ + BOOST_PP_CAT(arg, arg_n) + +#define BOOST_LOCAL_FUNCTION_AUX_arg_param_decl(z, arg_n, unused) \ + BOOST_LOCAL_FUNCTION_AUX_arg_param_type(z, arg_n, 0 /* no leading comma */)\ + BOOST_LOCAL_FUNCTION_AUX_arg_name(z, arg_n, 0 /* no leading comma */) + +#define BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, unused) \ + BOOST_PP_CAT(Bind, bind_n) + +#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_type(z, bind_n, unused) \ + , BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) + +#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_ref(z, bind_n, unused) \ + , BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) & + +#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam(z, bind_n, unused) \ + , typename BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) + +#define BOOST_LOCAL_FUNCTION_AUX_bind_name(z, bind_n, unused) \ + BOOST_PP_CAT(bing, bind_n) + +#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_param_decl(z, bind_n, unused) \ + , \ + BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) & \ + BOOST_LOCAL_FUNCTION_AUX_bind_name(z, bind_n, ~) + +#define BOOST_LOCAL_FUNCTION_AUX_bind_member(z, bind_n, unsued) \ + BOOST_PP_CAT(BOOST_LOCAL_FUNCTION_AUX_bind_name(z, bind_n, ~), _) + +#define BOOST_LOCAL_FUNCTION_AUX_comma_bind_member_deref(z, bind_n, unsued) \ + , member_deref< BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) >( \ + BOOST_LOCAL_FUNCTION_AUX_bind_member(z, bind_n, ~)) + +#define BOOST_LOCAL_FUNCTION_AUX_bind_member_init(z, bind_n, unused) \ + BOOST_LOCAL_FUNCTION_AUX_bind_member(z, bind_n, ~) = member_addr( \ + BOOST_LOCAL_FUNCTION_AUX_bind_name(z, bind_n, ~)); + +#define BOOST_LOCAL_FUNCTION_AUX_bind_member_decl(z, bind_n, unused) \ + /* must be ptr (not ref) so can use default constr */ \ + typename member_type< \ + BOOST_LOCAL_FUNCTION_AUX_bind_type(z, bind_n, ~) \ + >::pointer BOOST_LOCAL_FUNCTION_AUX_bind_member(z, bind_n, ~) ; + +#define BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, unused) \ + BOOST_PP_CAT(call_ptr, n) + +#define BOOST_LOCAL_FUNCTION_AUX_call_name(z, n, unused) \ + BOOST_PP_CAT(call, n) + +#define BOOST_LOCAL_FUNCTION_AUX_call_member(z, n, unused) \ + BOOST_PP_CAT(BOOST_LOCAL_FUNCTION_AUX_call_name(z, n, unused), _) + +#define BOOST_LOCAL_FUNCTION_AUX_call_typedef(z, n, arity) \ + typedef R (*BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, ~))( \ + object_ptr \ + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS, \ + BOOST_PP_TUPLE_EAT(3) \ + , \ + BOOST_PP_REPEAT_ ## z \ + )(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_comma_bind_ref, ~) \ + BOOST_PP_REPEAT_ ## z(BOOST_PP_SUB(arity, n), \ + BOOST_LOCAL_FUNCTION_AUX_arg_param_type, 1 /* leading comma */)\ + ); + +#define BOOST_LOCAL_FUNCTION_AUX_comma_call_param_decl(z, n, unused) \ + , \ + BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, ~) \ + BOOST_LOCAL_FUNCTION_AUX_call_name(z, n, ~) + +#define BOOST_LOCAL_FUNCTION_AUX_call_decl(z, n, unused) \ + BOOST_LOCAL_FUNCTION_AUX_call_ptr(z, n, ~) \ + BOOST_LOCAL_FUNCTION_AUX_call_member(z, n, ~); + +#define BOOST_LOCAL_FUNCTION_AUX_call_init(z, n, unused) \ + BOOST_LOCAL_FUNCTION_AUX_call_member(z, n, ~) = \ + BOOST_LOCAL_FUNCTION_AUX_call_name(z, n, ~); + +#define BOOST_LOCAL_FUNCTION_AUX_operator_call(z, defaults_n, arity) \ + /* precondition: object_ && call_function_ */ \ + inline R operator()( \ + BOOST_PP_ENUM_ ## z(BOOST_PP_SUB(arity, defaults_n), \ + BOOST_LOCAL_FUNCTION_AUX_arg_param_decl, ~) \ + ) /* cannot be const because of binds (same as for local ftor) */ { \ + /* run-time: do not assert preconditions here for efficiency */ \ + /* run-time: this function call is done via a function pointer */ \ + /* so unfortunately does not allow for compiler inlining */ \ + /* optimizations (an alternative using virtual function was also */ \ + /* investigated but also virtual functions cannot be optimized */ \ + /* plus they require virtual table lookups to the alternative */ \ + /* performed worst) */ \ + return BOOST_LOCAL_FUNCTION_AUX_call_member(z, defaults_n, ~)( \ + object_ \ + BOOST_PP_IIF( \ + BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS,\ + BOOST_PP_TUPLE_EAT(3) \ + , \ + BOOST_PP_REPEAT_ ## z \ + )(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_comma_bind_member_deref, ~) \ + BOOST_PP_REPEAT_ ## z(BOOST_PP_SUB(arity, defaults_n), \ + BOOST_LOCAL_FUNCTION_AUX_arg_name, 1 /* leading comma */) \ + ); \ + } + +namespace boost { namespace local_function { namespace aux { + +template< + typename F + , size_t defaults +#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS + BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, + BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam, ~) +#endif +> +class function {}; // Empty template, only use its specializations. + +// Iterate within namespace. +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3, (0, BOOST_LOCAL_FUNCTION_CONFIG_FUNCTION_ARITY_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_FUNCTION_THIS_FILE_)) +# include BOOST_PP_ITERATE() // Iterate over function arity. + +} } } // namespace + +// Register type for type-of emu (NAME use TYPEOF to deduce this fctor type). +#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::local_function::aux::function, + (typename) // For `F` tparam. + (size_t) // For `defaults` tparam. + // MSVC error if using #if instead of PP_IIF here. + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS, + BOOST_PP_TUPLE_EAT(3) // Nothing. + , + BOOST_PP_REPEAT // For bind tparams. + )(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, + BOOST_LOCAL_FUNCTION_AUX_typename_seq, ~) +) + +#undef BOOST_LOCAL_FUNCTION_AUX_typename_seq +#undef BOOST_LOCAL_FUNCTION_AUX_arg_type +#undef BOOST_LOCAL_FUNCTION_AUX_arg_typedef +#undef BOOST_LOCAL_FUNCTION_AUX_comma_arg_tparam +#undef BOOST_LOCAL_FUNCTION_AUX_arg_param_type +#undef BOOST_LOCAL_FUNCTION_AUX_arg_name +#undef BOOST_LOCAL_FUNCTION_AUX_arg_param_decl +#undef BOOST_LOCAL_FUNCTION_AUX_bind_type +#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_type +#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_ref +#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam +#undef BOOST_LOCAL_FUNCTION_AUX_bind_name +#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_param_decl +#undef BOOST_LOCAL_FUNCTION_AUX_bind_member +#undef BOOST_LOCAL_FUNCTION_AUX_comma_bind_member_deref +#undef BOOST_LOCAL_FUNCTION_AUX_bind_member_init +#undef BOOST_LOCAL_FUNCTION_AUX_bind_member_decl +#undef BOOST_LOCAL_FUNCTION_AUX_call_ptr +#undef BOOST_LOCAL_FUNCTION_AUX_call_name +#undef BOOST_LOCAL_FUNCTION_AUX_call_member +#undef BOOST_LOCAL_FUNCTION_AUX_call_typedef +#undef BOOST_LOCAL_FUNCTION_AUX_comma_call_param_decl +#undef BOOST_LOCAL_FUNCTION_AUX_call_decl +#undef BOOST_LOCAL_FUNCTION_AUX_call_init +#undef BOOST_LOCAL_FUNCTION_AUX_operator_call + +# endif // #include guard + +#else if BOOST_PP_ITERATION_DEPTH() == 1 +# define BOOST_LOCAL_FUNCTION_AUX_arity BOOST_PP_FRAME_ITERATION(1) +# define BOOST_PP_ITERATION_PARAMS_2 \ + (3, (0, BOOST_LOCAL_FUNCTION_AUX_arity, \ + BOOST_LOCAL_FUNCTION_AUX_FUNCTION_THIS_FILE_)) +# include BOOST_PP_ITERATE() // Iterate over default params count. +# undef BOOST_LOCAL_FUNCTION_AUX_arity + +#else if BOOST_PP_ITERATION_DEPTH() == 2 +# define BOOST_LOCAL_FUNCTION_AUX_defaults BOOST_PP_FRAME_ITERATION(2) + +template< + typename R + BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_AUX_arity, + BOOST_LOCAL_FUNCTION_AUX_comma_arg_tparam, ~) +#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS + BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, + BOOST_LOCAL_FUNCTION_AUX_comma_bind_tparam, ~) +#endif +> +class function< + R ( + BOOST_PP_ENUM(BOOST_LOCAL_FUNCTION_AUX_arity, + BOOST_LOCAL_FUNCTION_AUX_arg_type, ~) + ) + , BOOST_LOCAL_FUNCTION_AUX_defaults +#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS + BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, + BOOST_LOCAL_FUNCTION_AUX_comma_bind_type, ~) +#endif +> { + // The object type will actually be a local class which cannot be passed as + // a template parameter so a generic `void*` pointer is used to hold the + // object (this pointer will then be cased by the call-function implemented + // by the local class itself). This is the trick used to pass a local + // function as a template parameter. This trick uses function pointers for + // the call-functions and function pointers cannot always be optimized by + // the compiler (they cannot be inlined) thus this trick increased run-time + // (another trick using virtual functions for the local class was also + // investigated but also virtual functions cannot be inlined plus they + // require virtual tables lookups so the virtual functions trick measured + // worst run-time performance than the function pointer trick). + typedef void* object_ptr; + BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), + BOOST_LOCAL_FUNCTION_AUX_call_typedef, // INC for no defaults. + BOOST_LOCAL_FUNCTION_AUX_arity) + +public: + // Provide public type interface following Boost.Function names + // (traits must be defined in both this and the local functor). + BOOST_STATIC_CONSTANT(size_t, arity = BOOST_LOCAL_FUNCTION_AUX_arity); + typedef R result_type; + BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_AUX_arity, + BOOST_LOCAL_FUNCTION_AUX_arg_typedef, ~) + + // NOTE: Must have default constructor for init without function name in + // function macro expansion. + + // Cannot be private but it should never be used by programmers directly + // so used internal symbol. + inline void BOOST_LOCAL_FUNCTION_AUX_FUNCTION_INIT_CALL_FUNC( + object_ptr object +#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS + BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, + BOOST_LOCAL_FUNCTION_AUX_comma_bind_param_decl, ~) +#endif + BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), + BOOST_LOCAL_FUNCTION_AUX_comma_call_param_decl, ~) + ) { + object_ = object; +#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS + BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, + BOOST_LOCAL_FUNCTION_AUX_bind_member_init, ~) +#endif + BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), + BOOST_LOCAL_FUNCTION_AUX_call_init, ~) // INC for no defaults. + unused_ = 0; // To avoid a GCC uninitialized warning. + } + + // Result operator(Arg1, ..., ArgN-1, ArgN) -- iff defaults >= 0 + // Result operator(Arg1, ..., ArgN-1) -- iff defaults >= 1 + // ... -- etc + BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), + BOOST_LOCAL_FUNCTION_AUX_operator_call, // INC for no defaults. + BOOST_LOCAL_FUNCTION_AUX_arity) + +private: + object_ptr object_; +#if !BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS + BOOST_PP_REPEAT(BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX, + BOOST_LOCAL_FUNCTION_AUX_bind_member_decl, ~) +#endif + BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_AUX_defaults), + BOOST_LOCAL_FUNCTION_AUX_call_decl, ~) // INC for no defaults. + + // run-time: this unused void* member variable allows for compiler + // optimizations (at least on MSVC it reduces invocation time of about 50%) + void* unused_; +}; + +# undef BOOST_LOCAL_FUNCTION_AUX_defaults +#endif // iteration + diff --git a/mp/src/thirdparty/boost/mpl/apply_wrap.hpp b/mp/src/thirdparty/boost/mpl/apply_wrap.hpp index 5c5c6df6..474fefa8 100644 --- a/mp/src/thirdparty/boost/mpl/apply_wrap.hpp +++ b/mp/src/thirdparty/boost/mpl/apply_wrap.hpp @@ -1,234 +1,234 @@ - -#if !defined(BOOST_PP_IS_ITERATING) - -///// header body - -#ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED -#define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED - -// Copyright Aleksey Gurtovoy 2000-2008 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/mpl for documentation. - -// $Id: apply_wrap.hpp 49272 2008-10-11 06:50:46Z agurtovoy $ -// $Date: 2008-10-10 23:50:46 -0700 (Fri, 10 Oct 2008) $ -// $Revision: 49272 $ - -#if !defined(BOOST_MPL_PREPROCESSING_MODE) -# include -# include -# include -# include -#endif - -#include - -#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ - && !defined(BOOST_MPL_PREPROCESSING_MODE) - -# define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp -# include - -#else - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# include -# include -# include -# include - - -namespace boost { namespace mpl { - -// local macros, #undef-ined at the end of the header -# define AUX778076_APPLY_WRAP_PARAMS(n, param) \ - BOOST_MPL_PP_PARAMS(n, param) \ - /**/ - -# define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \ - BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \ - /**/ - - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, )) -#include BOOST_PP_ITERATE() - - -# undef AUX778076_APPLY_WRAP_SPEC_PARAMS -# undef AUX778076_APPLY_WRAP_PARAMS - -}} - -#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -#endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED - -///// iteration, depth == 1 - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 - -# define i_ BOOST_PP_FRAME_ITERATION(1) - -# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -// MSVC version - -#define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_) -#define AUX778076_MSVC_DTW_ORIGINAL_NAME apply -#define AUX778076_MSVC_DTW_ARITY i_ -#include - -template< - typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) - > -struct BOOST_PP_CAT(apply_wrap,i_) -{ - // Metafunction forwarding confuses vc6 - typedef typename BOOST_PP_CAT(msvc_apply,i_)::template result_< - AUX778076_APPLY_WRAP_PARAMS(i_, T) - >::type type; -}; - -# elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) -// MWCW/Borland version - -template< - int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) - > -struct BOOST_PP_CAT(apply_wrap_impl,i_); - -#define BOOST_PP_ITERATION_PARAMS_2 \ - (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, )) -#include BOOST_PP_ITERATE() - -template< - typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) - > -struct BOOST_PP_CAT(apply_wrap,i_) - : BOOST_PP_CAT(apply_wrap_impl,i_)< - ::boost::mpl::aux::arity::value - , F - BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) - >::type -{ -}; - -# else -// ISO98 C++, with minor concession to vc7 - -template< - typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) -#if i_ == 0 - , typename has_apply_ = typename aux::has_apply::type -#endif - > -struct BOOST_PP_CAT(apply_wrap,i_) -// metafunction forwarding confuses MSVC 7.0 -#if !BOOST_WORKAROUND(BOOST_MSVC, == 1300) - : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) > -{ -#else -{ - typedef typename F::template apply< - AUX778076_APPLY_WRAP_PARAMS(i_, T) - >::type type; -#endif -}; - -#if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -template< typename F > -struct BOOST_PP_CAT(apply_wrap,i_) - : F::apply -{ -}; -#endif - -# endif // workarounds - -#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG) -/// workaround for ETI bug -template<> -struct BOOST_PP_CAT(apply_wrap,i_) -{ - typedef int type; -}; -#endif - -# undef i_ - -///// iteration, depth == 2 - -#elif BOOST_PP_ITERATION_DEPTH() == 2 - -# define j_ BOOST_PP_FRAME_ITERATION(2) - -#if i_ == 0 && j_ == 0 \ - && defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) \ - && !defined(BOOST_MPL_CFG_NO_HAS_APPLY) - -template< typename F, bool F_has_apply > -struct apply_wrap_impl0_bcb { - typedef typename F::template apply< na > type; -}; - -template< typename F > -struct apply_wrap_impl0_bcb< F, true > { - typedef typename F::apply type; -}; - -template< - typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) - > -struct BOOST_PP_CAT(apply_wrap_impl,i_)< - BOOST_MPL_PP_ADD(i_, j_) - , F - BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) - > -{ - typedef apply_wrap_impl0_bcb< F, aux::has_apply< F >::value >::type type; -}; -#else - -template< - typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) - > -struct BOOST_PP_CAT(apply_wrap_impl,i_)< - BOOST_MPL_PP_ADD(i_, j_) - , F - BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) - > -{ - typedef typename F::template apply< - AUX778076_APPLY_WRAP_PARAMS(i_, T) -#if i_ == 0 && j_ == 0 -/// since the defaults are "lost", we have to pass *something* even for nullary -/// metafunction classes - na -#else - BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na) -#endif - > type; -}; - -#endif - -# undef j_ - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif // BOOST_PP_IS_ITERATING + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED +#define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2008 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: apply_wrap.hpp 49272 2008-10-11 06:50:46Z agurtovoy $ +// $Date: 2008-10-10 23:50:46 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49272 $ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +# include +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp +# include + +#else + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include +# include +# include +# include + + +namespace boost { namespace mpl { + +// local macros, #undef-ined at the end of the header +# define AUX778076_APPLY_WRAP_PARAMS(n, param) \ + BOOST_MPL_PP_PARAMS(n, param) \ + /**/ + +# define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \ + BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \ + /**/ + + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, )) +#include BOOST_PP_ITERATE() + + +# undef AUX778076_APPLY_WRAP_SPEC_PARAMS +# undef AUX778076_APPLY_WRAP_PARAMS + +}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED + +///// iteration, depth == 1 + +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 + +# define i_ BOOST_PP_FRAME_ITERATION(1) + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// MSVC version + +#define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_) +#define AUX778076_MSVC_DTW_ORIGINAL_NAME apply +#define AUX778076_MSVC_DTW_ARITY i_ +#include + +template< + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) + > +struct BOOST_PP_CAT(apply_wrap,i_) +{ + // Metafunction forwarding confuses vc6 + typedef typename BOOST_PP_CAT(msvc_apply,i_)::template result_< + AUX778076_APPLY_WRAP_PARAMS(i_, T) + >::type type; +}; + +# elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) +// MWCW/Borland version + +template< + int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) + > +struct BOOST_PP_CAT(apply_wrap_impl,i_); + +#define BOOST_PP_ITERATION_PARAMS_2 \ + (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, )) +#include BOOST_PP_ITERATE() + +template< + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) + > +struct BOOST_PP_CAT(apply_wrap,i_) + : BOOST_PP_CAT(apply_wrap_impl,i_)< + ::boost::mpl::aux::arity::value + , F + BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) + >::type +{ +}; + +# else +// ISO98 C++, with minor concession to vc7 + +template< + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) +#if i_ == 0 + , typename has_apply_ = typename aux::has_apply::type +#endif + > +struct BOOST_PP_CAT(apply_wrap,i_) +// metafunction forwarding confuses MSVC 7.0 +#if !BOOST_WORKAROUND(BOOST_MSVC, == 1300) + : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) > +{ +#else +{ + typedef typename F::template apply< + AUX778076_APPLY_WRAP_PARAMS(i_, T) + >::type type; +#endif +}; + +#if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +template< typename F > +struct BOOST_PP_CAT(apply_wrap,i_) + : F::apply +{ +}; +#endif + +# endif // workarounds + +#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG) +/// workaround for ETI bug +template<> +struct BOOST_PP_CAT(apply_wrap,i_) +{ + typedef int type; +}; +#endif + +# undef i_ + +///// iteration, depth == 2 + +#else if BOOST_PP_ITERATION_DEPTH() == 2 + +# define j_ BOOST_PP_FRAME_ITERATION(2) + +#if i_ == 0 && j_ == 0 \ + && defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) \ + && !defined(BOOST_MPL_CFG_NO_HAS_APPLY) + +template< typename F, bool F_has_apply > +struct apply_wrap_impl0_bcb { + typedef typename F::template apply< na > type; +}; + +template< typename F > +struct apply_wrap_impl0_bcb< F, true > { + typedef typename F::apply type; +}; + +template< + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) + > +struct BOOST_PP_CAT(apply_wrap_impl,i_)< + BOOST_MPL_PP_ADD(i_, j_) + , F + BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) + > +{ + typedef apply_wrap_impl0_bcb< F, aux::has_apply< F >::value >::type type; +}; +#else + +template< + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) + > +struct BOOST_PP_CAT(apply_wrap_impl,i_)< + BOOST_MPL_PP_ADD(i_, j_) + , F + BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) + > +{ + typedef typename F::template apply< + AUX778076_APPLY_WRAP_PARAMS(i_, T) +#if i_ == 0 && j_ == 0 +/// since the defaults are "lost", we have to pass *something* even for nullary +/// metafunction classes + na +#else + BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na) +#endif + > type; +}; + +#endif + +# undef j_ + +#endif // BOOST_PP_ITERATION_DEPTH() +#endif // BOOST_PP_IS_ITERATING diff --git a/mp/src/thirdparty/boost/mpl/aux_/advance_backward.hpp b/mp/src/thirdparty/boost/mpl/aux_/advance_backward.hpp index d44c59f8..5f68b5ff 100644 --- a/mp/src/thirdparty/boost/mpl/aux_/advance_backward.hpp +++ b/mp/src/thirdparty/boost/mpl/aux_/advance_backward.hpp @@ -1,128 +1,128 @@ - -#if !defined(BOOST_PP_IS_ITERATING) - -///// header body - -#ifndef BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED -#define BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED - -// Copyright Aleksey Gurtovoy 2000-2004 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/mpl for documentation. - -// $Id: advance_backward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ -// $Revision: 49267 $ - -#if !defined(BOOST_MPL_PREPROCESSING_MODE) -# include -# include -#endif - -#include - -#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ - && !defined(BOOST_MPL_PREPROCESSING_MODE) - -# define BOOST_MPL_PREPROCESSED_HEADER advance_backward.hpp -# include - -#else - -# include -# include -# include - -# include -# include -# include - -namespace boost { namespace mpl { namespace aux { - -// forward declaration -template< BOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_backward; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3,(0, BOOST_MPL_LIMIT_UNROLLING, )) -# include BOOST_PP_ITERATE() - -// implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING -template< BOOST_MPL_AUX_NTTP_DECL(long, N) > -struct advance_backward -{ - template< typename Iterator > struct apply - { - typedef typename apply_wrap1< - advance_backward - , Iterator - >::type chunk_result_; - - typedef typename apply_wrap1< - advance_backward<( - (N - BOOST_MPL_LIMIT_UNROLLING) < 0 - ? 0 - : N - BOOST_MPL_LIMIT_UNROLLING - )> - , chunk_result_ - >::type type; - }; -}; - -}}} - -#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -#endif // BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED - -///// iteration, depth == 1 - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 -#define i_ BOOST_PP_FRAME_ITERATION(1) - -template<> -struct advance_backward< BOOST_PP_FRAME_ITERATION(1) > -{ - template< typename Iterator > struct apply - { - typedef Iterator iter0; - -#if i_ > 0 -# define BOOST_PP_ITERATION_PARAMS_2 \ - (3,(1, BOOST_PP_FRAME_ITERATION(1), )) -# include BOOST_PP_ITERATE() -#endif - - typedef BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(1)) type; - }; - -#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG) - /// ETI workaround - template<> struct apply - { - typedef int type; - }; -#endif -}; - -#undef i_ - -///// iteration, depth == 2 - -#elif BOOST_PP_ITERATION_DEPTH() == 2 - -# define AUX778076_ITER_0 BOOST_PP_CAT(iter,BOOST_PP_DEC(BOOST_PP_FRAME_ITERATION(2))) -# define AUX778076_ITER_1 BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(2)) - - typedef typename prior::type AUX778076_ITER_1; - -# undef AUX778076_ITER_1 -# undef AUX778076_ITER_0 - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif // BOOST_PP_IS_ITERATING + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED +#define BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: advance_backward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER advance_backward.hpp +# include + +#else + +# include +# include +# include + +# include +# include +# include + +namespace boost { namespace mpl { namespace aux { + +// forward declaration +template< BOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_backward; + +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(0, BOOST_MPL_LIMIT_UNROLLING, )) +# include BOOST_PP_ITERATE() + +// implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING +template< BOOST_MPL_AUX_NTTP_DECL(long, N) > +struct advance_backward +{ + template< typename Iterator > struct apply + { + typedef typename apply_wrap1< + advance_backward + , Iterator + >::type chunk_result_; + + typedef typename apply_wrap1< + advance_backward<( + (N - BOOST_MPL_LIMIT_UNROLLING) < 0 + ? 0 + : N - BOOST_MPL_LIMIT_UNROLLING + )> + , chunk_result_ + >::type type; + }; +}; + +}}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif // BOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED + +///// iteration, depth == 1 + +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 +#define i_ BOOST_PP_FRAME_ITERATION(1) + +template<> +struct advance_backward< BOOST_PP_FRAME_ITERATION(1) > +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + +#if i_ > 0 +# define BOOST_PP_ITERATION_PARAMS_2 \ + (3,(1, BOOST_PP_FRAME_ITERATION(1), )) +# include BOOST_PP_ITERATE() +#endif + + typedef BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(1)) type; + }; + +#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG) + /// ETI workaround + template<> struct apply + { + typedef int type; + }; +#endif +}; + +#undef i_ + +///// iteration, depth == 2 + +#else if BOOST_PP_ITERATION_DEPTH() == 2 + +# define AUX778076_ITER_0 BOOST_PP_CAT(iter,BOOST_PP_DEC(BOOST_PP_FRAME_ITERATION(2))) +# define AUX778076_ITER_1 BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(2)) + + typedef typename prior::type AUX778076_ITER_1; + +# undef AUX778076_ITER_1 +# undef AUX778076_ITER_0 + +#endif // BOOST_PP_ITERATION_DEPTH() +#endif // BOOST_PP_IS_ITERATING diff --git a/mp/src/thirdparty/boost/mpl/aux_/advance_forward.hpp b/mp/src/thirdparty/boost/mpl/aux_/advance_forward.hpp index 4edd3ead..44310d68 100644 --- a/mp/src/thirdparty/boost/mpl/aux_/advance_forward.hpp +++ b/mp/src/thirdparty/boost/mpl/aux_/advance_forward.hpp @@ -1,127 +1,127 @@ - -#if !defined(BOOST_PP_IS_ITERATING) - -///// header body - -#ifndef BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED -#define BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED - -// Copyright Aleksey Gurtovoy 2000-2004 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/mpl for documentation. - -// $Id: advance_forward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ -// $Revision: 49267 $ - -#if !defined(BOOST_MPL_PREPROCESSING_MODE) -# include -# include -#endif - -#include - -#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ - && !defined(BOOST_MPL_PREPROCESSING_MODE) - -# define BOOST_MPL_PREPROCESSED_HEADER advance_forward.hpp -# include - -#else - -# include -# include -# include - -# include -# include -# include - -namespace boost { namespace mpl { namespace aux { - -// forward declaration -template< BOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_forward; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3,(0, BOOST_MPL_LIMIT_UNROLLING, )) -# include BOOST_PP_ITERATE() - -// implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING -template< BOOST_MPL_AUX_NTTP_DECL(long, N) > -struct advance_forward -{ - template< typename Iterator > struct apply - { - typedef typename apply_wrap1< - advance_forward - , Iterator - >::type chunk_result_; - - typedef typename apply_wrap1< - advance_forward<( - (N - BOOST_MPL_LIMIT_UNROLLING) < 0 - ? 0 - : N - BOOST_MPL_LIMIT_UNROLLING - )> - , chunk_result_ - >::type type; - }; -}; - -}}} - -#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -#endif // BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED - -///// iteration, depth == 1 - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 -#define i_ BOOST_PP_FRAME_ITERATION(1) - -template<> -struct advance_forward< BOOST_PP_FRAME_ITERATION(1) > -{ - template< typename Iterator > struct apply - { - typedef Iterator iter0; - -#if i_ > 0 -# define BOOST_PP_ITERATION_PARAMS_2 \ - (3,(1, i_, )) -# include BOOST_PP_ITERATE() -#endif - typedef BOOST_PP_CAT(iter,i_) type; - }; - -#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG) - /// ETI workaround - template<> struct apply - { - typedef int type; - }; -#endif -}; - -#undef i_ - -///// iteration, depth == 2 - -#elif BOOST_PP_ITERATION_DEPTH() == 2 - -# define AUX778076_ITER_0 BOOST_PP_CAT(iter,BOOST_PP_DEC(BOOST_PP_FRAME_ITERATION(2))) -# define AUX778076_ITER_1 BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(2)) - - typedef typename next::type AUX778076_ITER_1; - -# undef AUX778076_ITER_1 -# undef AUX778076_ITER_0 - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif // BOOST_PP_IS_ITERATING + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED +#define BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: advance_forward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +#endif + +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER advance_forward.hpp +# include + +#else + +# include +# include +# include + +# include +# include +# include + +namespace boost { namespace mpl { namespace aux { + +// forward declaration +template< BOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_forward; + +# define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(0, BOOST_MPL_LIMIT_UNROLLING, )) +# include BOOST_PP_ITERATE() + +// implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING +template< BOOST_MPL_AUX_NTTP_DECL(long, N) > +struct advance_forward +{ + template< typename Iterator > struct apply + { + typedef typename apply_wrap1< + advance_forward + , Iterator + >::type chunk_result_; + + typedef typename apply_wrap1< + advance_forward<( + (N - BOOST_MPL_LIMIT_UNROLLING) < 0 + ? 0 + : N - BOOST_MPL_LIMIT_UNROLLING + )> + , chunk_result_ + >::type type; + }; +}; + +}}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif // BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED + +///// iteration, depth == 1 + +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 +#define i_ BOOST_PP_FRAME_ITERATION(1) + +template<> +struct advance_forward< BOOST_PP_FRAME_ITERATION(1) > +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + +#if i_ > 0 +# define BOOST_PP_ITERATION_PARAMS_2 \ + (3,(1, i_, )) +# include BOOST_PP_ITERATE() +#endif + typedef BOOST_PP_CAT(iter,i_) type; + }; + +#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG) + /// ETI workaround + template<> struct apply + { + typedef int type; + }; +#endif +}; + +#undef i_ + +///// iteration, depth == 2 + +#else if BOOST_PP_ITERATION_DEPTH() == 2 + +# define AUX778076_ITER_0 BOOST_PP_CAT(iter,BOOST_PP_DEC(BOOST_PP_FRAME_ITERATION(2))) +# define AUX778076_ITER_1 BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(2)) + + typedef typename next::type AUX778076_ITER_1; + +# undef AUX778076_ITER_1 +# undef AUX778076_ITER_0 + +#endif // BOOST_PP_ITERATION_DEPTH() +#endif // BOOST_PP_IS_ITERATING diff --git a/mp/src/thirdparty/boost/mpl/bind.hpp b/mp/src/thirdparty/boost/mpl/bind.hpp index 25e46b4f..23712244 100644 --- a/mp/src/thirdparty/boost/mpl/bind.hpp +++ b/mp/src/thirdparty/boost/mpl/bind.hpp @@ -1,551 +1,551 @@ - -#if !defined(BOOST_PP_IS_ITERATING) - -///// header body - -#ifndef BOOST_MPL_BIND_HPP_INCLUDED -#define BOOST_MPL_BIND_HPP_INCLUDED - -// Copyright Peter Dimov 2001 -// Copyright Aleksey Gurtovoy 2001-2004 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/mpl for documentation. - -// $Id: bind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ -// $Revision: 49267 $ - -#if !defined(BOOST_MPL_PREPROCESSING_MODE) -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -# include -# endif -#endif - -#include -#include -#include - -#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ - && !defined(BOOST_MPL_PREPROCESSING_MODE) - -# if defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) -# define BOOST_MPL_PREPROCESSED_HEADER basic_bind.hpp -# else -# define BOOST_MPL_PREPROCESSED_HEADER bind.hpp -# endif -# include - -#else - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# include -# include -# include -# include - -namespace boost { namespace mpl { - -// local macros, #undef-ined at the end of the header -# define AUX778076_APPLY \ - BOOST_PP_CAT(apply_wrap,BOOST_MPL_LIMIT_METAFUNCTION_ARITY) \ - /**/ - -# if defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS) -# define AUX778076_DMC_PARAM() , int dummy_ -# else -# define AUX778076_DMC_PARAM() -# endif - -# define AUX778076_BIND_PARAMS(param) \ - BOOST_MPL_PP_PARAMS( \ - BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ - , param \ - ) \ - /**/ - -# define AUX778076_BIND_DEFAULT_PARAMS(param, value) \ - BOOST_MPL_PP_DEFAULT_PARAMS( \ - BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ - , param \ - , value \ - ) \ - /**/ - -# define AUX778076_BIND_N_PARAMS(n, param) \ - BOOST_PP_COMMA_IF(n) BOOST_MPL_PP_PARAMS(n, param) \ - /**/ - -# define AUX778076_BIND_N_SPEC_PARAMS(n, param, def) \ - BOOST_PP_COMMA_IF(n) \ - BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \ - /**/ - -#if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) -# define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \ - AUX778076_BIND_DEFAULT_PARAMS(param, value) \ - /**/ -#else -# define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \ - AUX778076_BIND_PARAMS(param) \ - /**/ -#endif - -namespace aux { - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -template< - typename T, AUX778076_BIND_PARAMS(typename U) - > -struct resolve_bind_arg -{ - typedef T type; -}; - -# if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) - -template< - typename T - , typename Arg - > -struct replace_unnamed_arg -{ - typedef Arg next; - typedef T type; -}; - -template< - typename Arg - > -struct replace_unnamed_arg< arg<-1>,Arg > -{ - typedef typename Arg::next next; - typedef Arg type; -}; - -# endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT - -template< - BOOST_MPL_AUX_NTTP_DECL(int, N), AUX778076_BIND_PARAMS(typename U) - > -struct resolve_bind_arg< arg,AUX778076_BIND_PARAMS(U) > -{ - typedef typename AUX778076_APPLY, AUX778076_BIND_PARAMS(U)>::type type; -}; - -#if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) -template< - typename F, AUX778076_BIND_PARAMS(typename T), AUX778076_BIND_PARAMS(typename U) - > -struct resolve_bind_arg< bind,AUX778076_BIND_PARAMS(U) > -{ - typedef bind f_; - typedef typename AUX778076_APPLY::type type; -}; -#endif - -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -// agurt, 15/jan/02: it's not a intended to be used as a function class, and -// MSVC6.5 has problems with 'apply' name here (the code compiles, but doesn't -// work), so I went with the 'result_' here, and in all other similar cases -template< bool > -struct resolve_arg_impl -{ - template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_ - { - typedef T type; - }; -}; - -template<> -struct resolve_arg_impl -{ - template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_ - { - typedef typename AUX778076_APPLY< - T - , AUX778076_BIND_PARAMS(U) - >::type type; - }; -}; - -// for 'resolve_bind_arg' -template< typename T > struct is_bind_template; - -template< - typename T, AUX778076_BIND_PARAMS(typename U) - > -struct resolve_bind_arg - : resolve_arg_impl< is_bind_template::value > - ::template result_< T,AUX778076_BIND_PARAMS(U) > -{ -}; - -# if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) - -template< typename T > -struct replace_unnamed_arg_impl -{ - template< typename Arg > struct result_ - { - typedef Arg next; - typedef T type; - }; -}; - -template<> -struct replace_unnamed_arg_impl< arg<-1> > -{ - template< typename Arg > struct result_ - { - typedef typename next::type next; - typedef Arg type; - }; -}; - -template< typename T, typename Arg > -struct replace_unnamed_arg - : replace_unnamed_arg_impl::template result_ -{ -}; - -# endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT - -// agurt, 10/mar/02: the forward declaration has to appear before any of -// 'is_bind_helper' overloads, otherwise MSVC6.5 issues an ICE on it -template< BOOST_MPL_AUX_NTTP_DECL(int, arity_) > struct bind_chooser; - -aux::no_tag is_bind_helper(...); -template< typename T > aux::no_tag is_bind_helper(protect*); - -// overload for "main" form -// agurt, 15/mar/02: MSVC 6.5 fails to properly resolve the overload -// in case if we use 'aux::type_wrapper< bind<...> >' here, and all -// 'bind' instantiations form a complete type anyway -#if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) -template< - typename F, AUX778076_BIND_PARAMS(typename T) - > -aux::yes_tag is_bind_helper(bind*); -#endif - -template< BOOST_MPL_AUX_NTTP_DECL(int, N) > -aux::yes_tag is_bind_helper(arg*); - -template< bool is_ref_ = true > -struct is_bind_template_impl -{ - template< typename T > struct result_ - { - BOOST_STATIC_CONSTANT(bool, value = false); - }; -}; - -template<> -struct is_bind_template_impl -{ - template< typename T > struct result_ - { - BOOST_STATIC_CONSTANT(bool, value = - sizeof(aux::is_bind_helper(static_cast(0))) - == sizeof(aux::yes_tag) - ); - }; -}; - -template< typename T > struct is_bind_template - : is_bind_template_impl< ::boost::detail::is_reference_impl::value > - ::template result_ -{ -}; - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -} // namespace aux - - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, )) -#include BOOST_PP_ITERATE() - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) -/// if_/eval_if specializations -# define AUX778076_SPEC_NAME if_ -# define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, )) -# include BOOST_PP_ITERATE() - -#if !defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS) -# define AUX778076_SPEC_NAME eval_if -# define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, )) -# include BOOST_PP_ITERATE() -#endif -#endif - -// real C++ version is already taken care of -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) - -namespace aux { -// apply_count_args -#define AUX778076_COUNT_ARGS_PREFIX bind -#define AUX778076_COUNT_ARGS_DEFAULT na -#define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY -#include -} - -// bind -template< - typename F, AUX778076_BIND_PARAMS(typename T) AUX778076_DMC_PARAM() - > -struct bind - : aux::bind_chooser< - aux::bind_count_args::value - >::template result_< F,AUX778076_BIND_PARAMS(T) >::type -{ -}; - -BOOST_MPL_AUX_ARITY_SPEC( - BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) - , bind - ) - -BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC( - BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) - , bind - ) - - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -# undef AUX778076_BIND_NESTED_DEFAULT_PARAMS -# undef AUX778076_BIND_N_SPEC_PARAMS -# undef AUX778076_BIND_N_PARAMS -# undef AUX778076_BIND_DEFAULT_PARAMS -# undef AUX778076_BIND_PARAMS -# undef AUX778076_DMC_PARAM -# undef AUX778076_APPLY - -}} - -#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -#endif // BOOST_MPL_BIND_HPP_INCLUDED - -///// iteration, depth == 1 - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 - -# define i_ BOOST_PP_FRAME_ITERATION(1) - -#if defined(AUX778076_SPEC_NAME) - -// lazy metafunction specialization -template< template< BOOST_MPL_PP_PARAMS(i_, typename T) > class F, typename Tag > -struct BOOST_PP_CAT(quote,i_); - -template< BOOST_MPL_PP_PARAMS(i_, typename T) > struct AUX778076_SPEC_NAME; - -template< - typename Tag AUX778076_BIND_N_PARAMS(i_, typename T) - > -struct BOOST_PP_CAT(bind,i_)< - BOOST_PP_CAT(quote,i_) - AUX778076_BIND_N_PARAMS(i_,T) - > -{ - template< - AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na) - > - struct apply - { - private: - typedef mpl::arg<1> n1; -# define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, )) -# include BOOST_PP_ITERATE() - - typedef typename AUX778076_SPEC_NAME< - typename t1::type - , BOOST_MPL_PP_EXT_PARAMS(2, BOOST_PP_INC(i_), t) - >::type f_; - - public: - typedef typename f_::type type; - }; -}; - -#undef AUX778076_SPEC_NAME - -#else // AUX778076_SPEC_NAME - -template< - typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() - > -struct BOOST_PP_CAT(bind,i_) -{ - template< - AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na) - > - struct apply - { - private: -# if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) - - typedef aux::replace_unnamed_arg< F,mpl::arg<1> > r0; - typedef typename r0::type a0; - typedef typename r0::next n1; - typedef typename aux::resolve_bind_arg::type f_; - /// -# else - typedef typename aux::resolve_bind_arg::type f_; - -# endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT - -# if i_ > 0 -# define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, )) -# include BOOST_PP_ITERATE() -# endif - - public: - -# define AUX778076_ARG(unused, i_, t) \ - BOOST_PP_COMMA_IF(i_) \ - typename BOOST_PP_CAT(t,BOOST_PP_INC(i_))::type \ -/**/ - - typedef typename BOOST_PP_CAT(apply_wrap,i_)< - f_ - BOOST_PP_COMMA_IF(i_) BOOST_MPL_PP_REPEAT(i_, AUX778076_ARG, t) - >::type type; - -# undef AUX778076_ARG - }; -}; - -namespace aux { - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -template< - typename F AUX778076_BIND_N_PARAMS(i_, typename T), AUX778076_BIND_PARAMS(typename U) - > -struct resolve_bind_arg< - BOOST_PP_CAT(bind,i_),AUX778076_BIND_PARAMS(U) - > -{ - typedef BOOST_PP_CAT(bind,i_) f_; - typedef typename AUX778076_APPLY::type type; -}; - -#else - -template< - typename F AUX778076_BIND_N_PARAMS(i_, typename T) - > -aux::yes_tag -is_bind_helper(BOOST_PP_CAT(bind,i_)*); - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -} // namespace aux - -BOOST_MPL_AUX_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_)) -BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_)) - -# if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) -# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -#if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY -/// primary template (not a specialization!) -template< - typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() - > -struct bind - : BOOST_PP_CAT(bind,i_) -{ -}; -#else -template< - typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() - > -struct bind< F AUX778076_BIND_N_SPEC_PARAMS(i_, T, na) > - : BOOST_PP_CAT(bind,i_) -{ -}; -#endif - -# else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -namespace aux { - -template<> -struct bind_chooser -{ - template< - typename F, AUX778076_BIND_PARAMS(typename T) - > - struct result_ - { - typedef BOOST_PP_CAT(bind,i_)< F AUX778076_BIND_N_PARAMS(i_,T) > type; - }; -}; - -} // namespace aux - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# endif // BOOST_MPL_CFG_NO_BIND_TEMPLATE - -#endif // AUX778076_SPEC_NAME - -# undef i_ - -///// iteration, depth == 2 - -#elif BOOST_PP_ITERATION_DEPTH() == 2 - -# define j_ BOOST_PP_FRAME_ITERATION(2) -# if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) - - typedef aux::replace_unnamed_arg< BOOST_PP_CAT(T,j_),BOOST_PP_CAT(n,j_) > BOOST_PP_CAT(r,j_); - typedef typename BOOST_PP_CAT(r,j_)::type BOOST_PP_CAT(a,j_); - typedef typename BOOST_PP_CAT(r,j_)::next BOOST_PP_CAT(n,BOOST_PP_INC(j_)); - typedef aux::resolve_bind_arg BOOST_PP_CAT(t,j_); - /// -# else - typedef aux::resolve_bind_arg< BOOST_PP_CAT(T,j_),AUX778076_BIND_PARAMS(U)> BOOST_PP_CAT(t,j_); - -# endif -# undef j_ - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif // BOOST_PP_IS_ITERATING + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_MPL_BIND_HPP_INCLUDED +#define BOOST_MPL_BIND_HPP_INCLUDED + +// Copyright Peter Dimov 2001 +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: bind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +# include +# endif +#endif + +#include +#include +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# if defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) +# define BOOST_MPL_PREPROCESSED_HEADER basic_bind.hpp +# else +# define BOOST_MPL_PREPROCESSED_HEADER bind.hpp +# endif +# include + +#else + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include +# include +# include +# include + +namespace boost { namespace mpl { + +// local macros, #undef-ined at the end of the header +# define AUX778076_APPLY \ + BOOST_PP_CAT(apply_wrap,BOOST_MPL_LIMIT_METAFUNCTION_ARITY) \ + /**/ + +# if defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS) +# define AUX778076_DMC_PARAM() , int dummy_ +# else +# define AUX778076_DMC_PARAM() +# endif + +# define AUX778076_BIND_PARAMS(param) \ + BOOST_MPL_PP_PARAMS( \ + BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ + , param \ + ) \ + /**/ + +# define AUX778076_BIND_DEFAULT_PARAMS(param, value) \ + BOOST_MPL_PP_DEFAULT_PARAMS( \ + BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ + , param \ + , value \ + ) \ + /**/ + +# define AUX778076_BIND_N_PARAMS(n, param) \ + BOOST_PP_COMMA_IF(n) BOOST_MPL_PP_PARAMS(n, param) \ + /**/ + +# define AUX778076_BIND_N_SPEC_PARAMS(n, param, def) \ + BOOST_PP_COMMA_IF(n) \ + BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \ + /**/ + +#if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) +# define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \ + AUX778076_BIND_DEFAULT_PARAMS(param, value) \ + /**/ +#else +# define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \ + AUX778076_BIND_PARAMS(param) \ + /**/ +#endif + +namespace aux { + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template< + typename T, AUX778076_BIND_PARAMS(typename U) + > +struct resolve_bind_arg +{ + typedef T type; +}; + +# if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) + +template< + typename T + , typename Arg + > +struct replace_unnamed_arg +{ + typedef Arg next; + typedef T type; +}; + +template< + typename Arg + > +struct replace_unnamed_arg< arg<-1>,Arg > +{ + typedef typename Arg::next next; + typedef Arg type; +}; + +# endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT + +template< + BOOST_MPL_AUX_NTTP_DECL(int, N), AUX778076_BIND_PARAMS(typename U) + > +struct resolve_bind_arg< arg,AUX778076_BIND_PARAMS(U) > +{ + typedef typename AUX778076_APPLY, AUX778076_BIND_PARAMS(U)>::type type; +}; + +#if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) +template< + typename F, AUX778076_BIND_PARAMS(typename T), AUX778076_BIND_PARAMS(typename U) + > +struct resolve_bind_arg< bind,AUX778076_BIND_PARAMS(U) > +{ + typedef bind f_; + typedef typename AUX778076_APPLY::type type; +}; +#endif + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +// agurt, 15/jan/02: it's not a intended to be used as a function class, and +// MSVC6.5 has problems with 'apply' name here (the code compiles, but doesn't +// work), so I went with the 'result_' here, and in all other similar cases +template< bool > +struct resolve_arg_impl +{ + template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_ + { + typedef T type; + }; +}; + +template<> +struct resolve_arg_impl +{ + template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_ + { + typedef typename AUX778076_APPLY< + T + , AUX778076_BIND_PARAMS(U) + >::type type; + }; +}; + +// for 'resolve_bind_arg' +template< typename T > struct is_bind_template; + +template< + typename T, AUX778076_BIND_PARAMS(typename U) + > +struct resolve_bind_arg + : resolve_arg_impl< is_bind_template::value > + ::template result_< T,AUX778076_BIND_PARAMS(U) > +{ +}; + +# if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) + +template< typename T > +struct replace_unnamed_arg_impl +{ + template< typename Arg > struct result_ + { + typedef Arg next; + typedef T type; + }; +}; + +template<> +struct replace_unnamed_arg_impl< arg<-1> > +{ + template< typename Arg > struct result_ + { + typedef typename next::type next; + typedef Arg type; + }; +}; + +template< typename T, typename Arg > +struct replace_unnamed_arg + : replace_unnamed_arg_impl::template result_ +{ +}; + +# endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT + +// agurt, 10/mar/02: the forward declaration has to appear before any of +// 'is_bind_helper' overloads, otherwise MSVC6.5 issues an ICE on it +template< BOOST_MPL_AUX_NTTP_DECL(int, arity_) > struct bind_chooser; + +aux::no_tag is_bind_helper(...); +template< typename T > aux::no_tag is_bind_helper(protect*); + +// overload for "main" form +// agurt, 15/mar/02: MSVC 6.5 fails to properly resolve the overload +// in case if we use 'aux::type_wrapper< bind<...> >' here, and all +// 'bind' instantiations form a complete type anyway +#if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) +template< + typename F, AUX778076_BIND_PARAMS(typename T) + > +aux::yes_tag is_bind_helper(bind*); +#endif + +template< BOOST_MPL_AUX_NTTP_DECL(int, N) > +aux::yes_tag is_bind_helper(arg*); + +template< bool is_ref_ = true > +struct is_bind_template_impl +{ + template< typename T > struct result_ + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; +}; + +template<> +struct is_bind_template_impl +{ + template< typename T > struct result_ + { + BOOST_STATIC_CONSTANT(bool, value = + sizeof(aux::is_bind_helper(static_cast(0))) + == sizeof(aux::yes_tag) + ); + }; +}; + +template< typename T > struct is_bind_template + : is_bind_template_impl< ::boost::detail::is_reference_impl::value > + ::template result_ +{ +}; + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace aux + + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, )) +#include BOOST_PP_ITERATE() + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) +/// if_/eval_if specializations +# define AUX778076_SPEC_NAME if_ +# define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, )) +# include BOOST_PP_ITERATE() + +#if !defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS) +# define AUX778076_SPEC_NAME eval_if +# define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, )) +# include BOOST_PP_ITERATE() +#endif +#endif + +// real C++ version is already taken care of +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) + +namespace aux { +// apply_count_args +#define AUX778076_COUNT_ARGS_PREFIX bind +#define AUX778076_COUNT_ARGS_DEFAULT na +#define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY +#include +} + +// bind +template< + typename F, AUX778076_BIND_PARAMS(typename T) AUX778076_DMC_PARAM() + > +struct bind + : aux::bind_chooser< + aux::bind_count_args::value + >::template result_< F,AUX778076_BIND_PARAMS(T) >::type +{ +}; + +BOOST_MPL_AUX_ARITY_SPEC( + BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) + , bind + ) + +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC( + BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) + , bind + ) + + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +# undef AUX778076_BIND_NESTED_DEFAULT_PARAMS +# undef AUX778076_BIND_N_SPEC_PARAMS +# undef AUX778076_BIND_N_PARAMS +# undef AUX778076_BIND_DEFAULT_PARAMS +# undef AUX778076_BIND_PARAMS +# undef AUX778076_DMC_PARAM +# undef AUX778076_APPLY + +}} + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif // BOOST_MPL_BIND_HPP_INCLUDED + +///// iteration, depth == 1 + +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 + +# define i_ BOOST_PP_FRAME_ITERATION(1) + +#if defined(AUX778076_SPEC_NAME) + +// lazy metafunction specialization +template< template< BOOST_MPL_PP_PARAMS(i_, typename T) > class F, typename Tag > +struct BOOST_PP_CAT(quote,i_); + +template< BOOST_MPL_PP_PARAMS(i_, typename T) > struct AUX778076_SPEC_NAME; + +template< + typename Tag AUX778076_BIND_N_PARAMS(i_, typename T) + > +struct BOOST_PP_CAT(bind,i_)< + BOOST_PP_CAT(quote,i_) + AUX778076_BIND_N_PARAMS(i_,T) + > +{ + template< + AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na) + > + struct apply + { + private: + typedef mpl::arg<1> n1; +# define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, )) +# include BOOST_PP_ITERATE() + + typedef typename AUX778076_SPEC_NAME< + typename t1::type + , BOOST_MPL_PP_EXT_PARAMS(2, BOOST_PP_INC(i_), t) + >::type f_; + + public: + typedef typename f_::type type; + }; +}; + +#undef AUX778076_SPEC_NAME + +#else // AUX778076_SPEC_NAME + +template< + typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() + > +struct BOOST_PP_CAT(bind,i_) +{ + template< + AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na) + > + struct apply + { + private: +# if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) + + typedef aux::replace_unnamed_arg< F,mpl::arg<1> > r0; + typedef typename r0::type a0; + typedef typename r0::next n1; + typedef typename aux::resolve_bind_arg::type f_; + /// +# else + typedef typename aux::resolve_bind_arg::type f_; + +# endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT + +# if i_ > 0 +# define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, )) +# include BOOST_PP_ITERATE() +# endif + + public: + +# define AUX778076_ARG(unused, i_, t) \ + BOOST_PP_COMMA_IF(i_) \ + typename BOOST_PP_CAT(t,BOOST_PP_INC(i_))::type \ +/**/ + + typedef typename BOOST_PP_CAT(apply_wrap,i_)< + f_ + BOOST_PP_COMMA_IF(i_) BOOST_MPL_PP_REPEAT(i_, AUX778076_ARG, t) + >::type type; + +# undef AUX778076_ARG + }; +}; + +namespace aux { + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template< + typename F AUX778076_BIND_N_PARAMS(i_, typename T), AUX778076_BIND_PARAMS(typename U) + > +struct resolve_bind_arg< + BOOST_PP_CAT(bind,i_),AUX778076_BIND_PARAMS(U) + > +{ + typedef BOOST_PP_CAT(bind,i_) f_; + typedef typename AUX778076_APPLY::type type; +}; + +#else + +template< + typename F AUX778076_BIND_N_PARAMS(i_, typename T) + > +aux::yes_tag +is_bind_helper(BOOST_PP_CAT(bind,i_)*); + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_)) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_)) + +# if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) +# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +#if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY +/// primary template (not a specialization!) +template< + typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() + > +struct bind + : BOOST_PP_CAT(bind,i_) +{ +}; +#else +template< + typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() + > +struct bind< F AUX778076_BIND_N_SPEC_PARAMS(i_, T, na) > + : BOOST_PP_CAT(bind,i_) +{ +}; +#endif + +# else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +namespace aux { + +template<> +struct bind_chooser +{ + template< + typename F, AUX778076_BIND_PARAMS(typename T) + > + struct result_ + { + typedef BOOST_PP_CAT(bind,i_)< F AUX778076_BIND_N_PARAMS(i_,T) > type; + }; +}; + +} // namespace aux + +# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# endif // BOOST_MPL_CFG_NO_BIND_TEMPLATE + +#endif // AUX778076_SPEC_NAME + +# undef i_ + +///// iteration, depth == 2 + +#else if BOOST_PP_ITERATION_DEPTH() == 2 + +# define j_ BOOST_PP_FRAME_ITERATION(2) +# if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) + + typedef aux::replace_unnamed_arg< BOOST_PP_CAT(T,j_),BOOST_PP_CAT(n,j_) > BOOST_PP_CAT(r,j_); + typedef typename BOOST_PP_CAT(r,j_)::type BOOST_PP_CAT(a,j_); + typedef typename BOOST_PP_CAT(r,j_)::next BOOST_PP_CAT(n,BOOST_PP_INC(j_)); + typedef aux::resolve_bind_arg BOOST_PP_CAT(t,j_); + /// +# else + typedef aux::resolve_bind_arg< BOOST_PP_CAT(T,j_),AUX778076_BIND_PARAMS(U)> BOOST_PP_CAT(t,j_); + +# endif +# undef j_ + +#endif // BOOST_PP_ITERATION_DEPTH() +#endif // BOOST_PP_IS_ITERATING diff --git a/mp/src/thirdparty/boost/numeric/conversion/detail/numeric_cast_traits.hpp b/mp/src/thirdparty/boost/numeric/conversion/detail/numeric_cast_traits.hpp index 150490d9..793f98c6 100644 --- a/mp/src/thirdparty/boost/numeric/conversion/detail/numeric_cast_traits.hpp +++ b/mp/src/thirdparty/boost/numeric/conversion/detail/numeric_cast_traits.hpp @@ -1,138 +1,138 @@ -// -//! Copyright (c) 2011-2012 -//! Brandon Kohn -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#if !defined(BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES) - - #include - - #if !defined(BOOST_NO_LONG_LONG) - #include - #endif - -#else -#if !BOOST_PP_IS_ITERATING - - #include - #include - #include - - #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) - #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_common.hpp") - #endif -// -//! Copyright (c) 2011-2012 -//! Brandon Kohn -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) - #pragma wave option(preserve: 1) - #endif - - //! These are the assumed common built in fundamental types (not typedefs/macros.) - #define BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() \ - (char) \ - (signed char) \ - (unsigned char) \ - (short) \ - (unsigned short) \ - (int) \ - (unsigned int) \ - (long) \ - (unsigned long) \ - (float) \ - (double) \ - (long double) \ - /***/ - - #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() - #define BOOST_NUMERIC_CONVERSION_SEQ_B() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() - -namespace boost { namespace numeric { - - #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), )) - #include BOOST_PP_ITERATE() - -}}//namespace boost::numeric; - - #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) - #pragma wave option(output: null) - #endif - - #if ( defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) ) || !defined(BOOST_NO_LONG_LONG) - - #undef BOOST_NUMERIC_CONVERSION_SEQ_A - #undef BOOST_NUMERIC_CONVERSION_SEQ_B - - #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) - #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_long_long.hpp") - #endif - -// -//! Copyright (c) 2011-2012 -//! Brandon Kohn -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) - #pragma wave option(preserve: 1) - #endif - -namespace boost { namespace numeric { - - #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()(boost::long_long_type)(boost::ulong_long_type) - #define BOOST_NUMERIC_CONVERSION_SEQ_B() (boost::long_long_type)(boost::ulong_long_type) - - #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), )) - #include BOOST_PP_ITERATE() - -}}//namespace boost::numeric; - - #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) - #pragma wave option(output: null) - #endif - - #endif - - #undef BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES - #undef BOOST_NUMERIC_CONVERSION_SEQ_A - #undef BOOST_NUMERIC_CONVERSION_SEQ_B - -#elif BOOST_PP_ITERATION_DEPTH() == 1 - - #define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_B())), )) - #include BOOST_PP_ITERATE() - -#elif BOOST_PP_ITERATION_DEPTH() == 2 - - //! Generate default traits for the specified source and target. - #define BOOST_NUMERIC_CONVERSION_A BOOST_PP_FRAME_ITERATION(1) - #define BOOST_NUMERIC_CONVERSION_B BOOST_PP_FRAME_ITERATION(2) - - template <> - struct numeric_cast_traits - < - BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_A, BOOST_NUMERIC_CONVERSION_SEQ_A()) - , BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B()) - > - { - typedef def_overflow_handler overflow_policy; - typedef UseInternalRangeChecker range_checking_policy; - typedef Trunc rounding_policy; - }; - - #undef BOOST_NUMERIC_CONVERSION_A - #undef BOOST_NUMERIC_CONVERSION_B - -#endif//! Depth 2. -#endif// BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES +// +//! Copyright (c) 2011-2012 +//! Brandon Kohn +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#if !defined(BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES) + + #include + + #if !defined(BOOST_NO_LONG_LONG) + #include + #endif + +#else +#if !BOOST_PP_IS_ITERATING + + #include + #include + #include + + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_common.hpp") + #endif +// +//! Copyright (c) 2011-2012 +//! Brandon Kohn +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(preserve: 1) + #endif + + //! These are the assumed common built in fundamental types (not typedefs/macros.) + #define BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() \ + (char) \ + (signed char) \ + (unsigned char) \ + (short) \ + (unsigned short) \ + (int) \ + (unsigned int) \ + (long) \ + (unsigned long) \ + (float) \ + (double) \ + (long double) \ + /***/ + + #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() + #define BOOST_NUMERIC_CONVERSION_SEQ_B() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() + +namespace boost { namespace numeric { + + #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), )) + #include BOOST_PP_ITERATE() + +}}//namespace boost::numeric; + + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(output: null) + #endif + + #if ( defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) ) || !defined(BOOST_NO_LONG_LONG) + + #undef BOOST_NUMERIC_CONVERSION_SEQ_A + #undef BOOST_NUMERIC_CONVERSION_SEQ_B + + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_long_long.hpp") + #endif + +// +//! Copyright (c) 2011-2012 +//! Brandon Kohn +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(preserve: 1) + #endif + +namespace boost { namespace numeric { + + #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()(boost::long_long_type)(boost::ulong_long_type) + #define BOOST_NUMERIC_CONVERSION_SEQ_B() (boost::long_long_type)(boost::ulong_long_type) + + #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), )) + #include BOOST_PP_ITERATE() + +}}//namespace boost::numeric; + + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(output: null) + #endif + + #endif + + #undef BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES + #undef BOOST_NUMERIC_CONVERSION_SEQ_A + #undef BOOST_NUMERIC_CONVERSION_SEQ_B + +#else if BOOST_PP_ITERATION_DEPTH() == 1 + + #define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_B())), )) + #include BOOST_PP_ITERATE() + +#else if BOOST_PP_ITERATION_DEPTH() == 2 + + //! Generate default traits for the specified source and target. + #define BOOST_NUMERIC_CONVERSION_A BOOST_PP_FRAME_ITERATION(1) + #define BOOST_NUMERIC_CONVERSION_B BOOST_PP_FRAME_ITERATION(2) + + template <> + struct numeric_cast_traits + < + BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_A, BOOST_NUMERIC_CONVERSION_SEQ_A()) + , BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B()) + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc rounding_policy; + }; + + #undef BOOST_NUMERIC_CONVERSION_A + #undef BOOST_NUMERIC_CONVERSION_B + +#endif//! Depth 2. +#endif// BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES diff --git a/mp/src/thirdparty/boost/python/detail/target.hpp b/mp/src/thirdparty/boost/python/detail/target.hpp index 891d241e..ae078308 100644 --- a/mp/src/thirdparty/boost/python/detail/target.hpp +++ b/mp/src/thirdparty/boost/python/detail/target.hpp @@ -63,7 +63,7 @@ BOOST_PP_IF(N, A0, void)(* target(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A))) )() # define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, )) # include BOOST_PP_ITERATE() -#elif BOOST_PP_ITERATION_DEPTH() == 2 +#else if BOOST_PP_ITERATION_DEPTH() == 2 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) # line BOOST_PP_LINE(__LINE__, target.hpp(pointers-to-members)) diff --git a/mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp b/mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp index 0609ad85..5a6dfbf7 100644 --- a/mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp +++ b/mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp @@ -1,101 +1,101 @@ -/*============================================================================= - Copyright (c) 2005-2007 Dan Marsden - Copyright (c) 2005-2007 Joel de Guzman - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ -#ifndef BOOST_PP_IS_ITERATING -#ifndef PHOENIX_STATEMENT_DETAIL_CATCH_ALL_EVAL_HPP -#define PHOENIX_STATEMENT_DETAIL_CATCH_ALL_EVAL_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { namespace phoenix { - class catch_all_eval - { - public: - template - struct result - { - typedef void type; - }; - - template - static void eval( - const Env& env, TryBody& tryBody, CatchAllBody& catchAllBody) - { - try - { - tryBody.eval(env); - } - catch(...) - { - catchAllBody.eval(env); - } - } - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (1, PHOENIX_CATCH_LIMIT, "boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp")) - -#include BOOST_PP_ITERATE() - - }; -}} - -#endif - -#elif BOOST_PP_ITERATION_DEPTH() == 1 - -#define PHOENIX_ITERATION BOOST_PP_ITERATION() - - template - static void eval( - const Env& env, TryBody& tryBody, - BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, CatchBody, catchBody), - CatchAllBody& catchAllBody) - { - try - { - tryBody.eval(env); - } - -#define BOOST_PP_ITERATION_PARAMS_2 \ - (3, (0, BOOST_PP_DEC(PHOENIX_ITERATION), "boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp")) - -#include BOOST_PP_ITERATE() - - catch(...) - { - catchAllBody.eval(env); - } - } - -#undef PHOENIX_ITERATION - -#elif BOOST_PP_ITERATION_DEPTH() == 2 - -#define PHOENIX_ITERATION BOOST_PP_ITERATION() - - catch(typename BOOST_PP_CAT(CatchBody, PHOENIX_ITERATION)::exception_type&) - { - BOOST_PP_CAT(catchBody, PHOENIX_ITERATION).eval(env); - } - -#undef PHOENIX_ITERATION - -#endif +/*============================================================================= + Copyright (c) 2005-2007 Dan Marsden + Copyright (c) 2005-2007 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#ifndef PHOENIX_STATEMENT_DETAIL_CATCH_ALL_EVAL_HPP +#define PHOENIX_STATEMENT_DETAIL_CATCH_ALL_EVAL_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace phoenix { + class catch_all_eval + { + public: + template + struct result + { + typedef void type; + }; + + template + static void eval( + const Env& env, TryBody& tryBody, CatchAllBody& catchAllBody) + { + try + { + tryBody.eval(env); + } + catch(...) + { + catchAllBody.eval(env); + } + } + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3, (1, PHOENIX_CATCH_LIMIT, "boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp")) + +#include BOOST_PP_ITERATE() + + }; +}} + +#endif + +#else if BOOST_PP_ITERATION_DEPTH() == 1 + +#define PHOENIX_ITERATION BOOST_PP_ITERATION() + + template + static void eval( + const Env& env, TryBody& tryBody, + BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, CatchBody, catchBody), + CatchAllBody& catchAllBody) + { + try + { + tryBody.eval(env); + } + +#define BOOST_PP_ITERATION_PARAMS_2 \ + (3, (0, BOOST_PP_DEC(PHOENIX_ITERATION), "boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp")) + +#include BOOST_PP_ITERATE() + + catch(...) + { + catchAllBody.eval(env); + } + } + +#undef PHOENIX_ITERATION + +#else if BOOST_PP_ITERATION_DEPTH() == 2 + +#define PHOENIX_ITERATION BOOST_PP_ITERATION() + + catch(typename BOOST_PP_CAT(CatchBody, PHOENIX_ITERATION)::exception_type&) + { + BOOST_PP_CAT(catchBody, PHOENIX_ITERATION).eval(env); + } + +#undef PHOENIX_ITERATION + +#endif diff --git a/mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp b/mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp index bc65e90a..e20d7585 100644 --- a/mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp +++ b/mp/src/thirdparty/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp @@ -1,79 +1,79 @@ -/*============================================================================= - Copyright (c) 2005-2007 Dan Marsden - Copyright (c) 2005-2007 Joel de Guzman - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ -#ifndef BOOST_PP_IS_ITERATING -#ifndef PHOENIX_STATEMENT_DETAIL_CATCH_EVAL_HPP -#define PHOENIX_STATEMENT_DETAIL_CATCH_EVAL_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { namespace phoenix { - class catch_eval - { - public: - template - struct result - { - typedef void type; - }; - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (1, PHOENIX_CATCH_LIMIT, "boost/spirit/home/phoenix/statement/detail/catch_eval.hpp")) - -#include BOOST_PP_ITERATE() - - }; -}} - -#endif - -#elif BOOST_PP_ITERATION_DEPTH() == 1 - -#define PHOENIX_ITERATION BOOST_PP_ITERATION() - - template - static void eval( - const Env& env, TryBody& tryBody, - BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, CatchBody, catchBody)) - { - try - { - tryBody.eval(env); - } - -#define BOOST_PP_ITERATION_PARAMS_2 \ - (3, (0, BOOST_PP_DEC(PHOENIX_ITERATION), "boost/spirit/home/phoenix/statement/detail/catch_eval.hpp")) - -#include BOOST_PP_ITERATE() - - } - -#undef PHOENIX_ITERATION - -#elif BOOST_PP_ITERATION_DEPTH() == 2 - -#define PHOENIX_ITERATION BOOST_PP_ITERATION() - - catch(typename BOOST_PP_CAT(CatchBody, PHOENIX_ITERATION)::exception_type&) - { - BOOST_PP_CAT(catchBody, PHOENIX_ITERATION).eval(env); - } - -#undef PHOENIX_ITERATION - -#endif +/*============================================================================= + Copyright (c) 2005-2007 Dan Marsden + Copyright (c) 2005-2007 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#ifndef PHOENIX_STATEMENT_DETAIL_CATCH_EVAL_HPP +#define PHOENIX_STATEMENT_DETAIL_CATCH_EVAL_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace phoenix { + class catch_eval + { + public: + template + struct result + { + typedef void type; + }; + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3, (1, PHOENIX_CATCH_LIMIT, "boost/spirit/home/phoenix/statement/detail/catch_eval.hpp")) + +#include BOOST_PP_ITERATE() + + }; +}} + +#endif + +#else if BOOST_PP_ITERATION_DEPTH() == 1 + +#define PHOENIX_ITERATION BOOST_PP_ITERATION() + + template + static void eval( + const Env& env, TryBody& tryBody, + BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, CatchBody, catchBody)) + { + try + { + tryBody.eval(env); + } + +#define BOOST_PP_ITERATION_PARAMS_2 \ + (3, (0, BOOST_PP_DEC(PHOENIX_ITERATION), "boost/spirit/home/phoenix/statement/detail/catch_eval.hpp")) + +#include BOOST_PP_ITERATE() + + } + +#undef PHOENIX_ITERATION + +#else if BOOST_PP_ITERATION_DEPTH() == 2 + +#define PHOENIX_ITERATION BOOST_PP_ITERATION() + + catch(typename BOOST_PP_CAT(CatchBody, PHOENIX_ITERATION)::exception_type&) + { + BOOST_PP_CAT(catchBody, PHOENIX_ITERATION).eval(env); + } + +#undef PHOENIX_ITERATION + +#endif diff --git a/mp/src/thirdparty/boost/variant/detail/substitute.hpp b/mp/src/thirdparty/boost/variant/detail/substitute.hpp index 97fe2054..455d4071 100644 --- a/mp/src/thirdparty/boost/variant/detail/substitute.hpp +++ b/mp/src/thirdparty/boost/variant/detail/substitute.hpp @@ -1,231 +1,231 @@ - -#if !defined(BOOST_PP_IS_ITERATING) - -///// header body - -//----------------------------------------------------------------------------- -// boost variant/detail/substitute.hpp header file -// See http://www.boost.org for updates, documentation, and revision history. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2003 -// Eric Friedman -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP -#define BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP - -#include "boost/mpl/aux_/config/ctps.hpp" - -#include "boost/variant/detail/substitute_fwd.hpp" -#include "boost/mpl/aux_/lambda_arity_param.hpp" -#include "boost/mpl/aux_/preprocessor/params.hpp" -#include "boost/mpl/aux_/preprocessor/repeat.hpp" -#include "boost/mpl/int_fwd.hpp" -#include "boost/mpl/limits/arity.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/empty.hpp" -#include "boost/preprocessor/arithmetic/inc.hpp" -#include "boost/preprocessor/iterate.hpp" - -namespace boost { -namespace detail { namespace variant { - -#if !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) - -/////////////////////////////////////////////////////////////////////////////// -// (detail) metafunction substitute -// -// Substitutes one type for another in the given type expression. -// - -// -// primary template -// -template < - typename T, typename Dest, typename Source - BOOST_MPL_AUX_LAMBDA_ARITY_PARAM( - typename Arity /* = ... (see substitute_fwd.hpp) */ - ) - > -struct substitute -{ - typedef T type; -}; - -// -// tag substitution specializations -// - -#define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG(CV_) \ - template \ - struct substitute< \ - CV_ Source \ - , Dest \ - , Source \ - BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) \ - > \ - { \ - typedef CV_ Dest type; \ - }; \ - /**/ - -BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG( BOOST_PP_EMPTY() ) -BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG(const) -BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG(volatile) -BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG(const volatile) - -#undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG - -// -// pointer specializations -// -#define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER(CV_) \ - template \ - struct substitute< \ - T * CV_ \ - , Dest \ - , Source \ - BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) \ - > \ - { \ - typedef typename substitute< \ - T, Dest, Source \ - >::type * CV_ type; \ - }; \ - /**/ - -BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER( BOOST_PP_EMPTY() ) -BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER(const) -BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER(volatile) -BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER(const volatile) - -#undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER - -// -// reference specializations -// -template -struct substitute< - T& - , Dest - , Source - BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) - > -{ - typedef typename substitute< - T, Dest, Source - >::type & type; -}; - -// -// template expression (i.e., F<...>) specializations -// - -#define BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL(N) \ - typedef typename substitute< \ - BOOST_PP_CAT(U,N), Dest, Source \ - >::type BOOST_PP_CAT(u,N); \ - /**/ - -#define BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF(z, N, _) \ - BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL( BOOST_PP_INC(N) ) \ - /**/ - -#define BOOST_PP_ITERATION_LIMITS (0,BOOST_MPL_LIMIT_METAFUNCTION_ARITY) -#define BOOST_PP_FILENAME_1 "boost/variant/detail/substitute.hpp" -#include BOOST_PP_ITERATE() - -#undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL -#undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF - -#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) - -}} // namespace detail::variant -} // namespace boost - -#endif // BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP - -///// iteration, depth == 1 - -#elif BOOST_PP_ITERATION_DEPTH() == 1 -#define i BOOST_PP_FRAME_ITERATION(1) - -#if i > 0 - -// -// template specializations -// -template < - template < BOOST_MPL_PP_PARAMS(i,typename P) > class T - , BOOST_MPL_PP_PARAMS(i,typename U) - , typename Dest - , typename Source - > -struct substitute< - T< BOOST_MPL_PP_PARAMS(i,U) > - , Dest - , Source - BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<( i )>) - > -{ -private: - BOOST_MPL_PP_REPEAT(i, BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF, _) - -public: - typedef T< BOOST_MPL_PP_PARAMS(i,u) > type; -}; - -// -// function specializations -// -template < - typename R - , BOOST_MPL_PP_PARAMS(i,typename U) - , typename Dest - , typename Source - > -struct substitute< - R (*)( BOOST_MPL_PP_PARAMS(i,U) ) - , Dest - , Source - BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) - > -{ -private: - typedef typename substitute< R, Dest, Source >::type r; - BOOST_MPL_PP_REPEAT(i, BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF, _) - -public: - typedef r (*type)( BOOST_MPL_PP_PARAMS(i,u) ); -}; - -#elif i == 0 - -// -// zero-arg function specialization -// -template < - typename R, typename Dest, typename Source - > -struct substitute< - R (*)( void ) - , Dest - , Source - BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) - > -{ -private: - typedef typename substitute< R, Dest, Source >::type r; - -public: - typedef r (*type)( void ); -}; - -#endif // i - -#undef i -#endif // BOOST_PP_IS_ITERATING + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +//----------------------------------------------------------------------------- +// boost variant/detail/substitute.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2003 +// Eric Friedman +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP +#define BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP + +#include "boost/mpl/aux_/config/ctps.hpp" + +#include "boost/variant/detail/substitute_fwd.hpp" +#include "boost/mpl/aux_/lambda_arity_param.hpp" +#include "boost/mpl/aux_/preprocessor/params.hpp" +#include "boost/mpl/aux_/preprocessor/repeat.hpp" +#include "boost/mpl/int_fwd.hpp" +#include "boost/mpl/limits/arity.hpp" +#include "boost/preprocessor/cat.hpp" +#include "boost/preprocessor/empty.hpp" +#include "boost/preprocessor/arithmetic/inc.hpp" +#include "boost/preprocessor/iterate.hpp" + +namespace boost { +namespace detail { namespace variant { + +#if !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) + +/////////////////////////////////////////////////////////////////////////////// +// (detail) metafunction substitute +// +// Substitutes one type for another in the given type expression. +// + +// +// primary template +// +template < + typename T, typename Dest, typename Source + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM( + typename Arity /* = ... (see substitute_fwd.hpp) */ + ) + > +struct substitute +{ + typedef T type; +}; + +// +// tag substitution specializations +// + +#define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG(CV_) \ + template \ + struct substitute< \ + CV_ Source \ + , Dest \ + , Source \ + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) \ + > \ + { \ + typedef CV_ Dest type; \ + }; \ + /**/ + +BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG( BOOST_PP_EMPTY() ) +BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG(const) +BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG(volatile) +BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG(const volatile) + +#undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_SUBSTITUTE_TAG + +// +// pointer specializations +// +#define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER(CV_) \ + template \ + struct substitute< \ + T * CV_ \ + , Dest \ + , Source \ + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) \ + > \ + { \ + typedef typename substitute< \ + T, Dest, Source \ + >::type * CV_ type; \ + }; \ + /**/ + +BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER( BOOST_PP_EMPTY() ) +BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER(const) +BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER(volatile) +BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER(const volatile) + +#undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL_HANDLE_POINTER + +// +// reference specializations +// +template +struct substitute< + T& + , Dest + , Source + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) + > +{ + typedef typename substitute< + T, Dest, Source + >::type & type; +}; + +// +// template expression (i.e., F<...>) specializations +// + +#define BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL(N) \ + typedef typename substitute< \ + BOOST_PP_CAT(U,N), Dest, Source \ + >::type BOOST_PP_CAT(u,N); \ + /**/ + +#define BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF(z, N, _) \ + BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL( BOOST_PP_INC(N) ) \ + /**/ + +#define BOOST_PP_ITERATION_LIMITS (0,BOOST_MPL_LIMIT_METAFUNCTION_ARITY) +#define BOOST_PP_FILENAME_1 "boost/variant/detail/substitute.hpp" +#include BOOST_PP_ITERATE() + +#undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL +#undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF + +#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) + +}} // namespace detail::variant +} // namespace boost + +#endif // BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP + +///// iteration, depth == 1 + +#else if BOOST_PP_ITERATION_DEPTH() == 1 +#define i BOOST_PP_FRAME_ITERATION(1) + +#if i > 0 + +// +// template specializations +// +template < + template < BOOST_MPL_PP_PARAMS(i,typename P) > class T + , BOOST_MPL_PP_PARAMS(i,typename U) + , typename Dest + , typename Source + > +struct substitute< + T< BOOST_MPL_PP_PARAMS(i,U) > + , Dest + , Source + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<( i )>) + > +{ +private: + BOOST_MPL_PP_REPEAT(i, BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF, _) + +public: + typedef T< BOOST_MPL_PP_PARAMS(i,u) > type; +}; + +// +// function specializations +// +template < + typename R + , BOOST_MPL_PP_PARAMS(i,typename U) + , typename Dest + , typename Source + > +struct substitute< + R (*)( BOOST_MPL_PP_PARAMS(i,U) ) + , Dest + , Source + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) + > +{ +private: + typedef typename substitute< R, Dest, Source >::type r; + BOOST_MPL_PP_REPEAT(i, BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF, _) + +public: + typedef r (*type)( BOOST_MPL_PP_PARAMS(i,u) ); +}; + +#elif i == 0 + +// +// zero-arg function specialization +// +template < + typename R, typename Dest, typename Source + > +struct substitute< + R (*)( void ) + , Dest + , Source + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>) + > +{ +private: + typedef typename substitute< R, Dest, Source >::type r; + +public: + typedef r (*type)( void ); +}; + +#endif // i + +#undef i +#endif // BOOST_PP_IS_ITERATING