sl@0: sl@0: #if !defined(BOOST_PP_IS_ITERATING) sl@0: sl@0: ///// header body sl@0: sl@0: #ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED sl@0: #define BOOST_MPL_APPLY_WRAP_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_wrap.hpp,v $ sl@0: // $Date: 2004/09/03 15:56:55 $ sl@0: // $Revision: 1.3 $ sl@0: sl@0: #if !defined(BOOST_MPL_PREPROCESSING_MODE) 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_wrap.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: sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: 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_WRAP_PARAMS(n, param) \ sl@0: BOOST_MPL_PP_PARAMS(n, param) \ sl@0: /**/ sl@0: sl@0: # define AUX778076_APPLY_WRAP_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: sl@0: # undef AUX778076_APPLY_WRAP_SPEC_PARAMS sl@0: # undef AUX778076_APPLY_WRAP_PARAMS sl@0: sl@0: }} sl@0: sl@0: #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS sl@0: #endif // BOOST_MPL_APPLY_WRAP_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: # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) sl@0: // MSVC version sl@0: sl@0: #define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_) sl@0: #define AUX778076_MSVC_DTW_ORIGINAL_NAME apply sl@0: #define AUX778076_MSVC_DTW_ARITY i_ sl@0: #include sl@0: sl@0: template< sl@0: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) sl@0: > sl@0: struct BOOST_PP_CAT(apply_wrap,i_) sl@0: { sl@0: // Metafunction forwarding confuses vc6 sl@0: typedef typename BOOST_PP_CAT(msvc_apply,i_)::template result_< sl@0: AUX778076_APPLY_WRAP_PARAMS(i_, T) sl@0: >::type type; sl@0: }; sl@0: sl@0: # elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) sl@0: // MWCW/Borland version sl@0: sl@0: template< sl@0: int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) sl@0: > sl@0: struct BOOST_PP_CAT(apply_wrap_impl,i_); sl@0: sl@0: #define BOOST_PP_ITERATION_PARAMS_2 \ sl@0: (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, )) sl@0: #include BOOST_PP_ITERATE() sl@0: sl@0: template< sl@0: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) sl@0: > sl@0: struct BOOST_PP_CAT(apply_wrap,i_) sl@0: : BOOST_PP_CAT(apply_wrap_impl,i_)< sl@0: ::boost::mpl::aux::arity::value sl@0: , F sl@0: BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) sl@0: >::type sl@0: { sl@0: }; sl@0: sl@0: # else sl@0: // ISO98 C++, with minor concession to vc7 sl@0: sl@0: template< sl@0: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) sl@0: #if i_ == 0 sl@0: , typename has_apply_ = typename aux::has_apply::type sl@0: #endif sl@0: > sl@0: struct BOOST_PP_CAT(apply_wrap,i_) sl@0: // metafunction forwarding confuses MSVC 7.0 sl@0: #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300) sl@0: : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) > sl@0: { sl@0: #else sl@0: { sl@0: typedef typename F::template apply< sl@0: AUX778076_APPLY_WRAP_PARAMS(i_, T) sl@0: >::type type; sl@0: #endif sl@0: }; sl@0: sl@0: #if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: template< typename F > sl@0: struct BOOST_PP_CAT(apply_wrap,i_) sl@0: : F::apply sl@0: { sl@0: }; sl@0: #endif sl@0: sl@0: # endif // workarounds 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_wrap,i_) sl@0: { sl@0: typedef int type; sl@0: }; sl@0: #endif sl@0: sl@0: # undef i_ sl@0: sl@0: ///// iteration, depth == 2 sl@0: sl@0: #elif BOOST_PP_ITERATION_DEPTH() == 2 sl@0: sl@0: # define j_ BOOST_PP_FRAME_ITERATION(2) sl@0: sl@0: template< sl@0: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) sl@0: > sl@0: struct BOOST_PP_CAT(apply_wrap_impl,i_)< sl@0: BOOST_MPL_PP_ADD(i_, j_) sl@0: , F sl@0: BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) sl@0: > sl@0: { sl@0: typedef typename F::template apply< sl@0: AUX778076_APPLY_WRAP_PARAMS(i_, T) sl@0: #if i_ == 0 && j_ == 0 sl@0: /// since the defaults are "lost", we have to pass *something* even for nullary sl@0: /// metafunction classes sl@0: na sl@0: #else sl@0: BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na) sl@0: #endif sl@0: > type; sl@0: }; sl@0: sl@0: # undef j_ sl@0: sl@0: #endif // BOOST_PP_IS_ITERATING