Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:57:24

0001 
0002 #if !defined(BOOST_PP_IS_ITERATING)
0003 
0004 ///// header body
0005 
0006 #ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
0007 #define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
0008 
0009 // Copyright Aleksey Gurtovoy 2000-2008
0010 //
0011 // Distributed under the Boost Software License, Version 1.0. 
0012 // (See accompanying file LICENSE_1_0.txt or copy at 
0013 // http://www.boost.org/LICENSE_1_0.txt)
0014 //
0015 // See http://www.boost.org/libs/mpl for documentation.
0016 
0017 // $Id$
0018 // $Date$
0019 // $Revision$
0020 
0021 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
0022 #   include <boost/mpl/aux_/arity.hpp>
0023 #   include <boost/mpl/aux_/has_apply.hpp>
0024 #   include <boost/mpl/aux_/na.hpp>
0025 #   include <boost/mpl/aux_/msvc_never_true.hpp>
0026 #endif
0027 
0028 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
0029 
0030 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
0031     && !defined(BOOST_MPL_PREPROCESSING_MODE)
0032 
0033 #   define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp
0034 #   include <boost/mpl/aux_/include_preprocessed.hpp>
0035 
0036 #else
0037 
0038 #   include <boost/mpl/limits/arity.hpp>
0039 #   include <boost/mpl/aux_/preprocessor/params.hpp>
0040 #   include <boost/mpl/aux_/preprocessor/enum.hpp>
0041 #   include <boost/mpl/aux_/preprocessor/add.hpp>
0042 #   include <boost/mpl/aux_/config/bcc.hpp>
0043 #   include <boost/mpl/aux_/config/ctps.hpp>
0044 #   include <boost/mpl/aux_/config/dtp.hpp>
0045 #   include <boost/mpl/aux_/config/eti.hpp>
0046 #   include <boost/mpl/aux_/config/msvc.hpp>
0047 #   include <boost/mpl/aux_/config/workaround.hpp>
0048 
0049 #   include <boost/preprocessor/comma_if.hpp>
0050 #   include <boost/preprocessor/logical/and.hpp>
0051 #   include <boost/preprocessor/inc.hpp>
0052 #   include <boost/preprocessor/iterate.hpp>
0053 
0054 
0055 namespace boost { namespace mpl {
0056 
0057 // local macros, #undef-ined at the end of the header
0058 #   define AUX778076_APPLY_WRAP_PARAMS(n, param) \
0059     BOOST_MPL_PP_PARAMS(n, param) \
0060     /**/
0061 
0062 #   define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \
0063     BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
0064     /**/
0065 
0066 
0067 #define BOOST_PP_ITERATION_PARAMS_1 \
0068     (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply_wrap.hpp>))
0069 #include BOOST_PP_ITERATE()
0070 
0071 
0072 #   undef AUX778076_APPLY_WRAP_SPEC_PARAMS
0073 #   undef AUX778076_APPLY_WRAP_PARAMS
0074 
0075 }}
0076 
0077 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
0078 #endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
0079 
0080 ///// iteration, depth == 1
0081 
0082 // For gcc 4.4 compatability, we must include the
0083 // BOOST_PP_ITERATION_DEPTH test inside an #else clause.
0084 #else // BOOST_PP_IS_ITERATING
0085 #if BOOST_PP_ITERATION_DEPTH() == 1
0086 
0087 #   define i_ BOOST_PP_FRAME_ITERATION(1)
0088 
0089 #   if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
0090 // MSVC version
0091 
0092 #define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_)
0093 #define AUX778076_MSVC_DTW_ORIGINAL_NAME apply
0094 #define AUX778076_MSVC_DTW_ARITY i_
0095 #include <boost/mpl/aux_/msvc_dtw.hpp>
0096 
0097 template<
0098       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
0099     >
0100 struct BOOST_PP_CAT(apply_wrap,i_)
0101 {
0102     // Metafunction forwarding confuses vc6
0103     typedef typename BOOST_PP_CAT(msvc_apply,i_)<F>::template result_<
0104           AUX778076_APPLY_WRAP_PARAMS(i_, T)
0105         >::type type;
0106 };
0107 
0108 #   elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
0109 // MWCW/Borland version
0110 
0111 template<
0112       int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
0113     >
0114 struct BOOST_PP_CAT(apply_wrap_impl,i_);
0115 
0116 #define BOOST_PP_ITERATION_PARAMS_2 \
0117     (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, <boost/mpl/apply_wrap.hpp>))
0118 #include BOOST_PP_ITERATE()
0119 
0120 template<
0121       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
0122     >
0123 struct BOOST_PP_CAT(apply_wrap,i_)
0124     : BOOST_PP_CAT(apply_wrap_impl,i_)<
0125           ::boost::mpl::aux::arity<F,i_>::value
0126         , F
0127         BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
0128         >::type
0129 {
0130 };
0131 
0132 #   else
0133 // ISO98 C++, with minor concession to vc7
0134 
0135 template<
0136       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
0137 #if i_ == 0
0138     , typename has_apply_ = typename aux::has_apply<F>::type
0139 #endif
0140     >
0141 struct BOOST_PP_CAT(apply_wrap,i_)
0142 // metafunction forwarding confuses MSVC 7.0
0143 #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300)
0144     : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) >
0145 {
0146 #else
0147 {    
0148     typedef typename F::template apply<
0149          AUX778076_APPLY_WRAP_PARAMS(i_, T)
0150         >::type type;
0151 #endif
0152 };
0153 
0154 #if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0155 template< typename F >
0156 struct BOOST_PP_CAT(apply_wrap,i_)<F,true_>
0157     : F::apply
0158 {
0159 };
0160 #endif
0161 
0162 #   endif // workarounds
0163 
0164 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
0165 /// workaround for ETI bug
0166 template<>
0167 struct BOOST_PP_CAT(apply_wrap,i_)<AUX778076_APPLY_WRAP_SPEC_PARAMS(i_, int)>
0168 {
0169     typedef int type;
0170 };
0171 #endif
0172 
0173 #   undef i_
0174 
0175 ///// iteration, depth == 2
0176 
0177 #elif BOOST_PP_ITERATION_DEPTH() == 2
0178 
0179 #   define j_ BOOST_PP_FRAME_ITERATION(2)
0180 
0181 #if i_ == 0 && j_ == 0 \
0182     && defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) \
0183     && !defined(BOOST_MPL_CFG_NO_HAS_APPLY)
0184 
0185 template< typename F, bool F_has_apply >
0186 struct apply_wrap_impl0_bcb {
0187     typedef typename F::template apply< na > type;
0188 };
0189 
0190 template< typename F >
0191 struct apply_wrap_impl0_bcb< F, true > {
0192     typedef typename F::apply type;
0193 };
0194 
0195 template<
0196       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
0197     >
0198 struct BOOST_PP_CAT(apply_wrap_impl,i_)<
0199           BOOST_MPL_PP_ADD(i_, j_)
0200         , F
0201         BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
0202         >
0203 {
0204     typedef apply_wrap_impl0_bcb< F, aux::has_apply< F >::value >::type type;
0205 };
0206 #else
0207 
0208 template<
0209       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
0210     >
0211 struct BOOST_PP_CAT(apply_wrap_impl,i_)<
0212           BOOST_MPL_PP_ADD(i_, j_)
0213         , F
0214         BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
0215         >
0216 {
0217     typedef typename F::template apply<
0218           AUX778076_APPLY_WRAP_PARAMS(i_, T)
0219 #if i_ == 0 && j_ == 0
0220 /// since the defaults are "lost", we have to pass *something* even for nullary
0221 /// metafunction classes
0222         na
0223 #else
0224         BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na)
0225 #endif
0226         > type;
0227 };
0228 
0229 #endif
0230 
0231 #   undef j_
0232 
0233 #endif // BOOST_PP_ITERATION_DEPTH()
0234 #endif // BOOST_PP_IS_ITERATING