Chris@16: Chris@16: #if !defined(BOOST_PP_IS_ITERATING) Chris@16: Chris@16: ///// header body Chris@16: Chris@16: #ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED Chris@16: #define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED 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: #if !defined(BOOST_MPL_PREPROCESSING_MODE) Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ Chris@16: && !defined(BOOST_MPL_PREPROCESSING_MODE) Chris@16: Chris@16: # define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp Chris@16: # include Chris@16: Chris@16: #else 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: # include Chris@16: # include Chris@16: Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: Chris@16: Chris@16: namespace boost { namespace mpl { Chris@16: Chris@16: // local macros, #undef-ined at the end of the header Chris@16: # define AUX778076_APPLY_WRAP_PARAMS(n, param) \ Chris@16: BOOST_MPL_PP_PARAMS(n, param) \ Chris@16: /**/ Chris@16: Chris@16: # define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \ Chris@16: BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \ Chris@16: /**/ Chris@16: Chris@16: Chris@16: #define BOOST_PP_ITERATION_PARAMS_1 \ Chris@16: (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, )) Chris@16: #include BOOST_PP_ITERATE() Chris@16: Chris@16: Chris@16: # undef AUX778076_APPLY_WRAP_SPEC_PARAMS Chris@16: # undef AUX778076_APPLY_WRAP_PARAMS Chris@16: Chris@16: }} Chris@16: Chris@16: #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS Chris@16: #endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED Chris@16: Chris@16: ///// iteration, depth == 1 Chris@16: Chris@16: // For gcc 4.4 compatability, we must include the Chris@16: // BOOST_PP_ITERATION_DEPTH test inside an #else clause. Chris@16: #else // BOOST_PP_IS_ITERATING Chris@16: #if BOOST_PP_ITERATION_DEPTH() == 1 Chris@16: Chris@16: # define i_ BOOST_PP_FRAME_ITERATION(1) Chris@16: Chris@16: # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) Chris@16: // MSVC version Chris@16: Chris@16: #define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_) Chris@16: #define AUX778076_MSVC_DTW_ORIGINAL_NAME apply Chris@16: #define AUX778076_MSVC_DTW_ARITY i_ Chris@16: #include Chris@16: Chris@16: template< Chris@16: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) Chris@16: > Chris@16: struct BOOST_PP_CAT(apply_wrap,i_) Chris@16: { Chris@16: // Metafunction forwarding confuses vc6 Chris@16: typedef typename BOOST_PP_CAT(msvc_apply,i_)::template result_< Chris@16: AUX778076_APPLY_WRAP_PARAMS(i_, T) Chris@16: >::type type; Chris@16: }; Chris@16: Chris@16: # elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) Chris@16: // MWCW/Borland version Chris@16: Chris@16: template< Chris@16: int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) Chris@16: > Chris@16: struct BOOST_PP_CAT(apply_wrap_impl,i_); Chris@16: Chris@16: #define BOOST_PP_ITERATION_PARAMS_2 \ Chris@16: (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, )) Chris@16: #include BOOST_PP_ITERATE() Chris@16: Chris@16: template< Chris@16: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) Chris@16: > Chris@16: struct BOOST_PP_CAT(apply_wrap,i_) Chris@16: : BOOST_PP_CAT(apply_wrap_impl,i_)< Chris@16: ::boost::mpl::aux::arity::value Chris@16: , F Chris@16: BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) Chris@16: >::type Chris@16: { Chris@16: }; Chris@16: Chris@16: # else Chris@16: // ISO98 C++, with minor concession to vc7 Chris@16: Chris@16: template< Chris@16: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) Chris@16: #if i_ == 0 Chris@16: , typename has_apply_ = typename aux::has_apply::type Chris@16: #endif Chris@16: > Chris@16: struct BOOST_PP_CAT(apply_wrap,i_) Chris@16: // metafunction forwarding confuses MSVC 7.0 Chris@16: #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300) Chris@16: : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) > Chris@16: { Chris@16: #else Chris@16: { Chris@16: typedef typename F::template apply< Chris@16: AUX778076_APPLY_WRAP_PARAMS(i_, T) Chris@16: >::type type; Chris@16: #endif Chris@16: }; Chris@16: Chris@16: #if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) Chris@16: template< typename F > Chris@16: struct BOOST_PP_CAT(apply_wrap,i_) Chris@16: : F::apply Chris@16: { Chris@16: }; Chris@16: #endif Chris@16: Chris@16: # endif // workarounds Chris@16: Chris@16: #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG) Chris@16: /// workaround for ETI bug Chris@16: template<> Chris@16: struct BOOST_PP_CAT(apply_wrap,i_) Chris@16: { Chris@16: typedef int type; Chris@16: }; Chris@16: #endif Chris@16: Chris@16: # undef i_ Chris@16: Chris@16: ///// iteration, depth == 2 Chris@16: Chris@16: #elif BOOST_PP_ITERATION_DEPTH() == 2 Chris@16: Chris@16: # define j_ BOOST_PP_FRAME_ITERATION(2) Chris@16: Chris@16: #if i_ == 0 && j_ == 0 \ Chris@16: && defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) \ Chris@16: && !defined(BOOST_MPL_CFG_NO_HAS_APPLY) Chris@16: Chris@16: template< typename F, bool F_has_apply > Chris@16: struct apply_wrap_impl0_bcb { Chris@16: typedef typename F::template apply< na > type; Chris@16: }; Chris@16: Chris@16: template< typename F > Chris@16: struct apply_wrap_impl0_bcb< F, true > { Chris@16: typedef typename F::apply type; Chris@16: }; Chris@16: Chris@16: template< Chris@16: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) Chris@16: > Chris@16: struct BOOST_PP_CAT(apply_wrap_impl,i_)< Chris@16: BOOST_MPL_PP_ADD(i_, j_) Chris@16: , F Chris@16: BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) Chris@16: > Chris@16: { Chris@16: typedef apply_wrap_impl0_bcb< F, aux::has_apply< F >::value >::type type; Chris@16: }; Chris@16: #else Chris@16: Chris@16: template< Chris@16: typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) Chris@16: > Chris@16: struct BOOST_PP_CAT(apply_wrap_impl,i_)< Chris@16: BOOST_MPL_PP_ADD(i_, j_) Chris@16: , F Chris@16: BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) Chris@16: > Chris@16: { Chris@16: typedef typename F::template apply< Chris@16: AUX778076_APPLY_WRAP_PARAMS(i_, T) Chris@16: #if i_ == 0 && j_ == 0 Chris@16: /// since the defaults are "lost", we have to pass *something* even for nullary Chris@16: /// metafunction classes Chris@16: na Chris@16: #else Chris@16: BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na) Chris@16: #endif Chris@16: > type; Chris@16: }; Chris@16: Chris@16: #endif Chris@16: Chris@16: # undef j_ Chris@16: Chris@16: #endif // BOOST_PP_ITERATION_DEPTH() Chris@16: #endif // BOOST_PP_IS_ITERATING