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_HPP_INCLUDED
0007 #define BOOST_MPL_APPLY_HPP_INCLUDED
0008 
0009 // Copyright Aleksey Gurtovoy 2000-2004
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/apply_fwd.hpp>
0023 #   include <boost/mpl/apply_wrap.hpp>
0024 #   include <boost/mpl/placeholders.hpp>
0025 #   include <boost/mpl/lambda.hpp>
0026 #   include <boost/mpl/aux_/na.hpp>
0027 #   include <boost/mpl/aux_/lambda_support.hpp>
0028 #endif
0029 
0030 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
0031 
0032 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
0033     && !defined(BOOST_MPL_PREPROCESSING_MODE)
0034 
0035 #   define BOOST_MPL_PREPROCESSED_HEADER apply.hpp
0036 #   include <boost/mpl/aux_/include_preprocessed.hpp>
0037 
0038 #else
0039 
0040 #   include <boost/mpl/limits/arity.hpp>
0041 #   include <boost/mpl/aux_/preprocessor/params.hpp>
0042 #   include <boost/mpl/aux_/preprocessor/default_params.hpp>
0043 #   include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
0044 #   include <boost/mpl/aux_/preprocessor/enum.hpp>
0045 #   include <boost/mpl/aux_/config/lambda.hpp>
0046 #   include <boost/mpl/aux_/config/dtp.hpp>
0047 #   include <boost/mpl/aux_/nttp_decl.hpp>
0048 #   include <boost/mpl/aux_/config/eti.hpp>
0049 #   include <boost/mpl/aux_/config/msvc.hpp>
0050 #   include <boost/mpl/aux_/config/workaround.hpp>
0051 
0052 #   include <boost/preprocessor/comma_if.hpp>
0053 #   include <boost/preprocessor/inc.hpp>
0054 #   include <boost/preprocessor/iterate.hpp>
0055 #   include <boost/preprocessor/cat.hpp>
0056 
0057 namespace boost { namespace mpl {
0058 
0059 // local macros, #undef-ined at the end of the header
0060 #   define AUX778076_APPLY_PARAMS(param) \
0061     BOOST_MPL_PP_PARAMS( \
0062           BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
0063         , param \
0064         ) \
0065     /**/
0066 
0067 #   define AUX778076_APPLY_DEF_PARAMS(param, value) \
0068     BOOST_MPL_PP_DEFAULT_PARAMS( \
0069           BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
0070         , param \
0071         , value \
0072         ) \
0073     /**/
0074 
0075 #   define AUX778076_APPLY_N_PARAMS(n, param) \
0076     BOOST_MPL_PP_PARAMS(n, param) \
0077     /**/
0078 
0079 #   define AUX778076_APPLY_N_COMMA_PARAMS(n, param) \
0080     BOOST_PP_COMMA_IF(n) \
0081     BOOST_MPL_PP_PARAMS(n, param) \
0082     /**/
0083 
0084 #   define AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(n, param, def) \
0085     BOOST_PP_COMMA_IF(n) \
0086     BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \
0087     /**/
0088     
0089 #   define AUX778076_APPLY_N_SPEC_PARAMS(n, param) \
0090     BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
0091     /**/
0092 
0093 
0094 #define BOOST_PP_ITERATION_PARAMS_1 \
0095     (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply.hpp>))
0096 #include BOOST_PP_ITERATE()
0097 
0098 #   if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
0099 // real C++ version is already taken care of
0100 #   if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0101 
0102 namespace aux {
0103 // apply_count_args
0104 #define AUX778076_COUNT_ARGS_PREFIX apply
0105 #define AUX778076_COUNT_ARGS_DEFAULT na
0106 #define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
0107 #include <boost/mpl/aux_/count_args.hpp>
0108 }
0109 
0110 
0111 template<
0112       typename F, AUX778076_APPLY_DEF_PARAMS(typename T, na)
0113     >
0114 struct apply
0115     : aux::apply_chooser< 
0116           aux::apply_count_args< AUX778076_APPLY_PARAMS(T) >::value
0117         >::template result_< F, AUX778076_APPLY_PARAMS(T) >::type
0118 {
0119 };
0120 
0121 #   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
0122 #   endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
0123 
0124 #   undef AUX778076_APPLY_N_SPEC_PARAMS
0125 #   undef AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS
0126 #   undef AUX778076_APPLY_N_COMMA_PARAMS
0127 #   undef AUX778076_APPLY_N_PARAMS
0128 #   undef AUX778076_APPLY_DEF_PARAMS
0129 #   undef AUX778076_APPLY_PARAMS
0130 
0131 }}
0132 
0133 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
0134 #endif // BOOST_MPL_APPLY_HPP_INCLUDED
0135 
0136 ///// iteration, depth == 1
0137 
0138 // For gcc 4.4 compatability, we must include the
0139 // BOOST_PP_ITERATION_DEPTH test inside an #else clause.
0140 #else // BOOST_PP_IS_ITERATING
0141 #if BOOST_PP_ITERATION_DEPTH() == 1
0142 
0143 #   define i_ BOOST_PP_FRAME_ITERATION(1)
0144 
0145 template<
0146       typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
0147     >
0148 struct BOOST_PP_CAT(apply,i_)
0149 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
0150     : BOOST_PP_CAT(apply_wrap,i_)< 
0151           typename lambda<F>::type
0152         AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
0153         >
0154 {
0155 #else
0156 {
0157     typedef typename BOOST_PP_CAT(apply_wrap,i_)< 
0158           typename lambda<F>::type
0159         AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
0160         >::type type;
0161 #endif
0162     BOOST_MPL_AUX_LAMBDA_SUPPORT(
0163           BOOST_PP_INC(i_)
0164         , BOOST_PP_CAT(apply,i_)
0165         , (F AUX778076_APPLY_N_COMMA_PARAMS(i_,T))
0166         )
0167 };
0168 
0169 
0170 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
0171 /// workaround for ETI bug
0172 template<>
0173 struct BOOST_PP_CAT(apply,i_)<AUX778076_APPLY_N_SPEC_PARAMS(i_, int)>
0174 {
0175     typedef int type;
0176 };
0177 #endif
0178 
0179 #   if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
0180 #   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0181 
0182 #if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY
0183 /// primary template (not a specialization!)
0184 template<
0185       typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
0186     >
0187 struct apply
0188     : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
0189 {
0190 };
0191 #else
0192 template<
0193       typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
0194     >
0195 struct apply< F AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(i_, T, na) >
0196     : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
0197 {
0198 };
0199 #endif
0200 
0201 #   else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
0202 
0203 #if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
0204 namespace aux {
0205 
0206 template<>
0207 struct apply_chooser<i_>
0208 {
0209     template<
0210           typename F, AUX778076_APPLY_PARAMS(typename T)
0211         >
0212     struct result_
0213     {
0214         typedef BOOST_PP_CAT(apply,i_)<
0215               F AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
0216             > type;
0217     };
0218 };
0219 
0220 } // namespace aux
0221 #endif
0222 
0223 #   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
0224 #   endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
0225 
0226 #   undef i_
0227 
0228 #endif // BOOST_PP_ITERATION_DEPTH()
0229 #endif // BOOST_PP_IS_ITERATING