Chris@16: Chris@16: // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION Chris@16: Chris@16: #if !defined(BOOST_PP_IS_ITERATING) Chris@16: Chris@16: ///// header body Chris@16: Chris@16: // Copyright Aleksey Gurtovoy 2000-2008 Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/mpl for documentation. Chris@16: Chris@101: // $Id$ Chris@101: // $Date$ Chris@101: // $Revision$ Chris@16: Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: Chris@16: #if defined(BOOST_MPL_PREPROCESSING_MODE) Chris@16: # undef LONG_MAX Chris@16: #endif Chris@16: Chris@16: namespace boost { namespace mpl { Chris@16: Chris@16: #if !defined(AUX778076_SEQUENCE_BASE_NAME) Chris@16: # define AUX778076_SEQUENCE_BASE_NAME AUX778076_SEQUENCE_NAME Chris@16: #endif Chris@16: Chris@16: #if !defined(AUX778076_SEQUENCE_INTEGRAL_WRAPPER) Chris@16: Chris@16: # define AUX778076_SEQUENCE_PARAM_NAME T Chris@16: # define AUX778076_SEQUENCE_TEMPLATE_PARAM typename T Chris@16: # define AUX778076_SEQUENCE_DEFAULT na Chris@16: Chris@16: # define AUX778076_SEQUENCE_NAME_N(n) \ Chris@16: BOOST_PP_CAT(AUX778076_SEQUENCE_BASE_NAME,n) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_PARAMS() \ Chris@16: BOOST_PP_ENUM_PARAMS( \ Chris@16: AUX778076_SEQUENCE_LIMIT \ Chris@16: , AUX778076_SEQUENCE_TEMPLATE_PARAM \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_ARGS() \ Chris@16: BOOST_PP_ENUM_PARAMS( \ Chris@16: AUX778076_SEQUENCE_LIMIT \ Chris@16: , T \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_DEFAULT_PARAMS() \ Chris@16: BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \ Chris@16: AUX778076_SEQUENCE_LIMIT \ Chris@16: , AUX778076_SEQUENCE_TEMPLATE_PARAM \ Chris@16: , AUX778076_SEQUENCE_DEFAULT \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_N_PARAMS(n) \ Chris@16: BOOST_PP_ENUM_PARAMS(n, AUX778076_SEQUENCE_TEMPLATE_PARAM) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_N_ARGS(n) \ Chris@16: BOOST_PP_ENUM_PARAMS(n, T) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS(n) \ Chris@16: BOOST_PP_ENUM_PARAMS(n, T) \ Chris@16: BOOST_PP_COMMA_IF(n) \ Chris@16: BOOST_PP_ENUM( \ Chris@16: BOOST_PP_SUB_D(1,AUX778076_SEQUENCE_LIMIT,n) \ Chris@16: , BOOST_PP_TUPLE_ELEM_3_2 \ Chris@16: , AUX778076_SEQUENCE_DEFAULT \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: #else // AUX778076_SEQUENCE_INTEGRAL_WRAPPER Chris@16: Chris@16: # define AUX778076_SEQUENCE_PARAM_NAME C Chris@16: # define AUX778076_SEQUENCE_TEMPLATE_PARAM BOOST_MPL_AUX_NTTP_DECL(long, C) Chris@16: # define AUX778076_SEQUENCE_DEFAULT LONG_MAX Chris@16: Chris@16: # define AUX778076_SEQUENCE_PARAMS() \ Chris@16: typename T, BOOST_PP_ENUM_PARAMS( \ Chris@16: AUX778076_SEQUENCE_LIMIT \ Chris@16: , AUX778076_SEQUENCE_TEMPLATE_PARAM \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_ARGS() \ Chris@16: T, BOOST_PP_ENUM_PARAMS( \ Chris@16: AUX778076_SEQUENCE_LIMIT \ Chris@16: , C \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_DEFAULT_PARAMS() \ Chris@16: typename T, \ Chris@16: BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \ Chris@16: AUX778076_SEQUENCE_LIMIT \ Chris@16: , AUX778076_SEQUENCE_TEMPLATE_PARAM \ Chris@16: , AUX778076_SEQUENCE_DEFAULT \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_N_PARAMS(n) \ Chris@16: typename T BOOST_PP_COMMA_IF(n) \ Chris@16: BOOST_PP_ENUM_PARAMS(n, AUX778076_SEQUENCE_TEMPLATE_PARAM) \ Chris@16: /**/ Chris@16: Chris@16: # if !defined(AUX778076_SEQUENCE_CONVERT_CN_TO) Chris@16: # define AUX778076_SEQUENCE_CONVERT_CN_TO(z,n,TARGET) BOOST_PP_CAT(C,n) Chris@16: # endif Chris@16: Chris@16: # define AUX778076_SEQUENCE_N_ARGS(n) \ Chris@16: T BOOST_PP_COMMA_IF(n) \ Chris@16: BOOST_PP_ENUM(n,AUX778076_SEQUENCE_CONVERT_CN_TO,T) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS(n) \ Chris@16: T, BOOST_PP_ENUM_PARAMS(n, C) \ Chris@16: BOOST_PP_COMMA_IF(n) \ Chris@16: BOOST_PP_ENUM( \ Chris@16: BOOST_PP_SUB_D(1,AUX778076_SEQUENCE_LIMIT,n) \ Chris@16: , BOOST_PP_TUPLE_ELEM_3_2 \ Chris@16: , AUX778076_SEQUENCE_DEFAULT \ Chris@16: ) \ Chris@16: /**/ Chris@16: Chris@16: #endif // AUX778076_SEQUENCE_INTEGRAL_WRAPPER Chris@16: Chris@16: Chris@16: #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) Chris@16: // forward declaration Chris@16: template< Chris@16: AUX778076_SEQUENCE_DEFAULT_PARAMS() Chris@16: > Chris@16: struct AUX778076_SEQUENCE_NAME; Chris@16: #else Chris@16: namespace aux { Chris@16: template< BOOST_MPL_AUX_NTTP_DECL(int, N) > Chris@16: struct BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_chooser); Chris@16: } Chris@16: #endif Chris@16: Chris@16: #define BOOST_PP_ITERATION_PARAMS_1 \ Chris@16: (3,(0, AUX778076_SEQUENCE_LIMIT, )) Chris@16: #include BOOST_PP_ITERATE() Chris@16: Chris@16: // real C++ version is already taken care of Chris@16: #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) Chris@16: Chris@16: namespace aux { Chris@16: // ???_count_args Chris@16: #define AUX778076_COUNT_ARGS_PREFIX AUX778076_SEQUENCE_NAME Chris@16: #define AUX778076_COUNT_ARGS_DEFAULT AUX778076_SEQUENCE_DEFAULT Chris@16: #define AUX778076_COUNT_ARGS_PARAM_NAME AUX778076_SEQUENCE_PARAM_NAME Chris@16: #define AUX778076_COUNT_ARGS_TEMPLATE_PARAM AUX778076_SEQUENCE_TEMPLATE_PARAM Chris@16: #define AUX778076_COUNT_ARGS_ARITY AUX778076_SEQUENCE_LIMIT Chris@16: #define AUX778076_COUNT_ARGS_USE_STANDARD_PP_PRIMITIVES Chris@16: #include Chris@16: Chris@16: template< Chris@16: AUX778076_SEQUENCE_PARAMS() Chris@16: > Chris@16: struct BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_impl) Chris@16: { Chris@16: typedef aux::BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_count_args)< Chris@16: BOOST_PP_ENUM_PARAMS(AUX778076_SEQUENCE_LIMIT, AUX778076_SEQUENCE_PARAM_NAME) Chris@16: > arg_num_; Chris@16: Chris@16: typedef typename aux::BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_chooser)< arg_num_::value > Chris@16: ::template result_< AUX778076_SEQUENCE_ARGS() >::type type; Chris@16: }; Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: template< Chris@16: AUX778076_SEQUENCE_DEFAULT_PARAMS() Chris@16: > Chris@16: struct AUX778076_SEQUENCE_NAME Chris@16: : aux::BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_impl)< Chris@16: AUX778076_SEQUENCE_ARGS() Chris@16: >::type Chris@16: { Chris@16: typedef typename aux::BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_impl)< Chris@16: AUX778076_SEQUENCE_ARGS() Chris@16: >::type type; Chris@16: }; Chris@16: Chris@16: #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION Chris@16: Chris@16: # undef AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS Chris@16: # undef AUX778076_SEQUENCE_N_ARGS Chris@16: # undef AUX778076_SEQUENCE_CONVERT_CN_TO Chris@16: # undef AUX778076_SEQUENCE_N_PARAMS Chris@16: # undef AUX778076_SEQUENCE_DEFAULT_PARAMS Chris@16: # undef AUX778076_SEQUENCE_ARGS Chris@16: # undef AUX778076_SEQUENCE_PARAMS Chris@16: # undef AUX778076_SEQUENCE_NAME_N Chris@16: # undef AUX778076_SEQUENCE_DEFAULT Chris@16: # undef AUX778076_SEQUENCE_TEMPLATE_PARAM Chris@16: # undef AUX778076_SEQUENCE_PARAM_NAME Chris@16: # undef AUX778076_SEQUENCE_LIMIT Chris@16: # undef AUX778076_SEQUENCE_BASE_NAME Chris@16: # undef AUX778076_SEQUENCE_NAME Chris@16: # undef AUX778076_SEQUENCE_INTEGRAL_WRAPPER Chris@16: Chris@16: }} Chris@16: Chris@16: ///// iteration Chris@16: Chris@16: #else Chris@16: #define i_ BOOST_PP_FRAME_ITERATION(1) Chris@16: Chris@16: # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) Chris@16: Chris@16: #if i_ == AUX778076_SEQUENCE_LIMIT Chris@16: Chris@16: /// primary template (not a specialization!) Chris@16: template< Chris@16: AUX778076_SEQUENCE_N_PARAMS(i_) Chris@16: > Chris@16: struct AUX778076_SEQUENCE_NAME Chris@16: : AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) > Chris@16: { Chris@16: typedef typename AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) >::type type; Chris@16: }; Chris@16: Chris@16: #else Chris@16: Chris@16: template< Chris@16: AUX778076_SEQUENCE_N_PARAMS(i_) Chris@16: > Chris@16: struct AUX778076_SEQUENCE_NAME< AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS(i_) > Chris@16: : AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) > Chris@16: { Chris@16: #if i_ > 0 || defined(AUX778076_SEQUENCE_INTEGRAL_WRAPPER) Chris@16: typedef typename AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) >::type type; Chris@16: #else Chris@16: typedef AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) >::type type; Chris@16: #endif Chris@16: }; Chris@16: Chris@16: #endif // i_ == AUX778076_SEQUENCE_LIMIT Chris@16: Chris@16: # else Chris@16: Chris@16: namespace aux { Chris@16: Chris@16: template<> Chris@16: struct BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_chooser) Chris@16: { Chris@16: template< Chris@16: AUX778076_SEQUENCE_PARAMS() Chris@16: > Chris@16: struct result_ Chris@16: { Chris@16: #if i_ > 0 || defined(AUX778076_SEQUENCE_INTEGRAL_WRAPPER) Chris@16: typedef typename AUX778076_SEQUENCE_NAME_N(i_)< Chris@16: AUX778076_SEQUENCE_N_ARGS(i_) Chris@16: >::type type; Chris@16: #else Chris@16: typedef AUX778076_SEQUENCE_NAME_N(i_)< Chris@16: AUX778076_SEQUENCE_N_ARGS(i_) Chris@16: >::type type; Chris@16: #endif Chris@16: }; Chris@16: }; Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION Chris@16: Chris@16: #undef i_ Chris@16: #endif // BOOST_PP_IS_ITERATING