2 #if !defined(BOOST_PP_IS_ITERATING)
\r
6 #ifndef BOOST_MPL_APPLY_HPP_INCLUDED
\r
7 #define BOOST_MPL_APPLY_HPP_INCLUDED
\r
9 // Copyright Aleksey Gurtovoy 2000-2004
\r
11 // Distributed under the Boost Software License, Version 1.0.
\r
12 // (See accompanying file LICENSE_1_0.txt or copy at
\r
13 // http://www.boost.org/LICENSE_1_0.txt)
\r
15 // See http://www.boost.org/libs/mpl for documentation.
\r
17 // $Id: apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
\r
18 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
\r
19 // $Revision: 49267 $
\r
21 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
\r
22 # include <boost/mpl/apply_fwd.hpp>
\r
23 # include <boost/mpl/apply_wrap.hpp>
\r
24 # include <boost/mpl/placeholders.hpp>
\r
25 # include <boost/mpl/lambda.hpp>
\r
26 # include <boost/mpl/aux_/na.hpp>
\r
27 # include <boost/mpl/aux_/lambda_support.hpp>
\r
30 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
\r
32 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
\r
33 && !defined(BOOST_MPL_PREPROCESSING_MODE)
\r
35 # define BOOST_MPL_PREPROCESSED_HEADER apply.hpp
\r
36 # include <boost/mpl/aux_/include_preprocessed.hpp>
\r
40 # include <boost/mpl/limits/arity.hpp>
\r
41 # include <boost/mpl/aux_/preprocessor/params.hpp>
\r
42 # include <boost/mpl/aux_/preprocessor/default_params.hpp>
\r
43 # include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
\r
44 # include <boost/mpl/aux_/preprocessor/enum.hpp>
\r
45 # include <boost/mpl/aux_/config/lambda.hpp>
\r
46 # include <boost/mpl/aux_/config/dtp.hpp>
\r
47 # include <boost/mpl/aux_/nttp_decl.hpp>
\r
48 # include <boost/mpl/aux_/config/eti.hpp>
\r
49 # include <boost/mpl/aux_/config/msvc.hpp>
\r
50 # include <boost/mpl/aux_/config/workaround.hpp>
\r
52 # include <boost/preprocessor/comma_if.hpp>
\r
53 # include <boost/preprocessor/inc.hpp>
\r
54 # include <boost/preprocessor/iterate.hpp>
\r
55 # include <boost/preprocessor/cat.hpp>
\r
57 namespace boost { namespace mpl {
\r
59 // local macros, #undef-ined at the end of the header
\r
60 # define AUX778076_APPLY_PARAMS(param) \
\r
61 BOOST_MPL_PP_PARAMS( \
\r
62 BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
\r
67 # define AUX778076_APPLY_DEF_PARAMS(param, value) \
\r
68 BOOST_MPL_PP_DEFAULT_PARAMS( \
\r
69 BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
\r
75 # define AUX778076_APPLY_N_PARAMS(n, param) \
\r
76 BOOST_MPL_PP_PARAMS(n, param) \
\r
79 # define AUX778076_APPLY_N_COMMA_PARAMS(n, param) \
\r
80 BOOST_PP_COMMA_IF(n) \
\r
81 BOOST_MPL_PP_PARAMS(n, param) \
\r
84 # define AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(n, param, def) \
\r
85 BOOST_PP_COMMA_IF(n) \
\r
86 BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \
\r
89 # define AUX778076_APPLY_N_SPEC_PARAMS(n, param) \
\r
90 BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
\r
94 #define BOOST_PP_ITERATION_PARAMS_1 \
\r
95 (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply.hpp>))
\r
96 #include BOOST_PP_ITERATE()
\r
98 # if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
\r
99 // real C++ version is already taken care of
\r
100 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
103 // apply_count_args
\r
104 #define AUX778076_COUNT_ARGS_PREFIX apply
\r
105 #define AUX778076_COUNT_ARGS_DEFAULT na
\r
106 #define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
\r
107 #include <boost/mpl/aux_/count_args.hpp>
\r
112 typename F, AUX778076_APPLY_DEF_PARAMS(typename T, na)
\r
115 : aux::apply_chooser<
\r
116 aux::apply_count_args< AUX778076_APPLY_PARAMS(T) >::value
\r
117 >::template result_< F, AUX778076_APPLY_PARAMS(T) >::type
\r
121 # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
\r
122 # endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
\r
124 # undef AUX778076_APPLY_N_SPEC_PARAMS
\r
125 # undef AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS
\r
126 # undef AUX778076_APPLY_N_COMMA_PARAMS
\r
127 # undef AUX778076_APPLY_N_PARAMS
\r
128 # undef AUX778076_APPLY_DEF_PARAMS
\r
129 # undef AUX778076_APPLY_PARAMS
\r
133 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
\r
134 #endif // BOOST_MPL_APPLY_HPP_INCLUDED
\r
136 ///// iteration, depth == 1
\r
138 // For gcc 4.4 compatability, we must include the
\r
139 // BOOST_PP_ITERATION_DEPTH test inside an #else clause.
\r
140 #else // BOOST_PP_IS_ITERATING
\r
141 #if BOOST_PP_ITERATION_DEPTH() == 1
\r
143 # define i_ BOOST_PP_FRAME_ITERATION(1)
\r
146 typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
\r
148 struct BOOST_PP_CAT(apply,i_)
\r
149 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
\r
150 : BOOST_PP_CAT(apply_wrap,i_)<
\r
151 typename lambda<F>::type
\r
152 AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
\r
157 typedef typename BOOST_PP_CAT(apply_wrap,i_)<
\r
158 typename lambda<F>::type
\r
159 AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
\r
162 BOOST_MPL_AUX_LAMBDA_SUPPORT(
\r
164 , BOOST_PP_CAT(apply,i_)
\r
165 , (F AUX778076_APPLY_N_COMMA_PARAMS(i_,T))
\r
170 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
\r
171 /// workaround for ETI bug
\r
173 struct BOOST_PP_CAT(apply,i_)<AUX778076_APPLY_N_SPEC_PARAMS(i_, int)>
\r
179 # if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
\r
180 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
182 #if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY
\r
183 /// primary template (not a specialization!)
\r
185 typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
\r
188 : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
\r
193 typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
\r
195 struct apply< F AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(i_, T, na) >
\r
196 : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
\r
201 # else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
\r
203 #if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
\r
207 struct apply_chooser<i_>
\r
210 typename F, AUX778076_APPLY_PARAMS(typename T)
\r
214 typedef BOOST_PP_CAT(apply,i_)<
\r
215 F AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
\r
223 # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
\r
224 # endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
\r
228 #endif // BOOST_PP_ITERATION_DEPTH()
\r
229 #endif // BOOST_PP_IS_ITERATING
\r