sl@0: sl@0: #if !defined(BOOST_PP_IS_ITERATING) sl@0: sl@0: ///// header body sl@0: sl@0: #ifndef BOOST_MPL_APPLY_HPP_INCLUDED sl@0: #define BOOST_MPL_APPLY_HPP_INCLUDED sl@0: sl@0: // Copyright Aleksey Gurtovoy 2000-2004 sl@0: // sl@0: // Distributed under the Boost Software License, Version 1.0. sl@0: // (See accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: // sl@0: // See http://www.boost.org/libs/mpl for documentation. sl@0: sl@0: // $Source: /cvsroot/boost/boost/boost/mpl/apply.hpp,v $ sl@0: // $Date: 2004/09/02 15:40:41 $ sl@0: // $Revision: 1.17 $ sl@0: sl@0: #if !defined(BOOST_MPL_PREPROCESSING_MODE) sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: #endif sl@0: sl@0: #include sl@0: sl@0: #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ sl@0: && !defined(BOOST_MPL_PREPROCESSING_MODE) sl@0: sl@0: # define BOOST_MPL_PREPROCESSED_HEADER apply.hpp sl@0: # include sl@0: sl@0: #else sl@0: sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: sl@0: namespace boost { namespace mpl { sl@0: sl@0: // local macros, #undef-ined at the end of the header sl@0: # define AUX778076_APPLY_PARAMS(param) \ sl@0: BOOST_MPL_PP_PARAMS( \ sl@0: BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ sl@0: , param \ sl@0: ) \ sl@0: /**/ sl@0: sl@0: # define AUX778076_APPLY_DEF_PARAMS(param, value) \ sl@0: BOOST_MPL_PP_DEFAULT_PARAMS( \ sl@0: BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ sl@0: , param \ sl@0: , value \ sl@0: ) \ sl@0: /**/ sl@0: sl@0: # define AUX778076_APPLY_N_PARAMS(n, param) \ sl@0: BOOST_MPL_PP_PARAMS(n, param) \ sl@0: /**/ sl@0: sl@0: # define AUX778076_APPLY_N_COMMA_PARAMS(n, param) \ sl@0: BOOST_PP_COMMA_IF(n) \ sl@0: BOOST_MPL_PP_PARAMS(n, param) \ sl@0: /**/ sl@0: sl@0: # define AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(n, param, def) \ sl@0: BOOST_PP_COMMA_IF(n) \ sl@0: BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \ sl@0: /**/ sl@0: sl@0: # define AUX778076_APPLY_N_SPEC_PARAMS(n, param) \ sl@0: BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \ sl@0: /**/ sl@0: sl@0: sl@0: #define BOOST_PP_ITERATION_PARAMS_1 \ sl@0: (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, )) sl@0: #include BOOST_PP_ITERATE() sl@0: sl@0: # if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE) sl@0: // real C++ version is already taken care of sl@0: # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: sl@0: namespace aux { sl@0: // apply_count_args sl@0: #define AUX778076_COUNT_ARGS_PREFIX apply sl@0: #define AUX778076_COUNT_ARGS_DEFAULT na sl@0: #define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY sl@0: #include sl@0: } sl@0: sl@0: sl@0: template< sl@0: typename F, AUX778076_APPLY_DEF_PARAMS(typename T, na) sl@0: > sl@0: struct apply sl@0: : aux::apply_chooser< sl@0: aux::apply_count_args< AUX778076_APPLY_PARAMS(T) >::value sl@0: >::template result_< F, AUX778076_APPLY_PARAMS(T) >::type sl@0: { sl@0: }; sl@0: sl@0: # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION sl@0: # endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE sl@0: sl@0: # undef AUX778076_APPLY_N_SPEC_PARAMS sl@0: # undef AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS sl@0: # undef AUX778076_APPLY_N_COMMA_PARAMS sl@0: # undef AUX778076_APPLY_N_PARAMS sl@0: # undef AUX778076_APPLY_DEF_PARAMS sl@0: # undef AUX778076_APPLY_PARAMS sl@0: sl@0: }} sl@0: sl@0: #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS sl@0: #endif // BOOST_MPL_APPLY_HPP_INCLUDED sl@0: sl@0: ///// iteration, depth == 1 sl@0: sl@0: #elif BOOST_PP_ITERATION_DEPTH() == 1 sl@0: sl@0: # define i_ BOOST_PP_FRAME_ITERATION(1) sl@0: sl@0: template< sl@0: typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T) sl@0: > sl@0: struct BOOST_PP_CAT(apply,i_) sl@0: #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) sl@0: : BOOST_PP_CAT(apply_wrap,i_)< sl@0: typename lambda::type sl@0: AUX778076_APPLY_N_COMMA_PARAMS(i_, T) sl@0: > sl@0: { sl@0: #else sl@0: { sl@0: typedef typename BOOST_PP_CAT(apply_wrap,i_)< sl@0: typename lambda::type sl@0: AUX778076_APPLY_N_COMMA_PARAMS(i_, T) sl@0: >::type type; sl@0: #endif sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT( sl@0: BOOST_PP_INC(i_) sl@0: , BOOST_PP_CAT(apply,i_) sl@0: , (F AUX778076_APPLY_N_COMMA_PARAMS(i_,T)) sl@0: ) sl@0: }; sl@0: sl@0: sl@0: #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG) sl@0: /// workaround for ETI bug sl@0: template<> sl@0: struct BOOST_PP_CAT(apply,i_) sl@0: { sl@0: typedef int type; sl@0: }; sl@0: #endif sl@0: sl@0: # if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE) sl@0: # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: sl@0: #if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY sl@0: /// primary template (not a specialization!) sl@0: template< sl@0: typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T) sl@0: > sl@0: struct apply sl@0: : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) > sl@0: { sl@0: }; sl@0: #else sl@0: template< sl@0: typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T) sl@0: > sl@0: struct apply< F AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(i_, T, na) > sl@0: : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) > sl@0: { sl@0: }; sl@0: #endif sl@0: sl@0: # else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION sl@0: sl@0: #if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE) sl@0: namespace aux { sl@0: sl@0: template<> sl@0: struct apply_chooser sl@0: { sl@0: template< sl@0: typename F, AUX778076_APPLY_PARAMS(typename T) sl@0: > sl@0: struct result_ sl@0: { sl@0: typedef BOOST_PP_CAT(apply,i_)< sl@0: F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) sl@0: > type; sl@0: }; sl@0: }; sl@0: sl@0: } // namespace aux sl@0: #endif sl@0: sl@0: # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION sl@0: # endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE sl@0: sl@0: # undef i_ sl@0: sl@0: #endif // BOOST_PP_IS_ITERATING