Update contrib.
2 #if !defined(BOOST_PP_IS_ITERATING)
6 #ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
7 #define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
9 // Copyright Aleksey Gurtovoy 2000-2004
11 // Distributed under the Boost Software License, Version 1.0.
12 // (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
15 // See http://www.boost.org/libs/mpl for documentation.
17 // $Source: /cvsroot/boost/boost/boost/mpl/apply_wrap.hpp,v $
18 // $Date: 2004/09/03 15:56:55 $
21 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
22 # include <boost/mpl/aux_/arity.hpp>
23 # include <boost/mpl/aux_/has_apply.hpp>
24 # include <boost/mpl/aux_/na.hpp>
25 # include <boost/mpl/aux_/msvc_never_true.hpp>
28 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
30 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
31 && !defined(BOOST_MPL_PREPROCESSING_MODE)
33 # define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp
34 # include <boost/mpl/aux_/include_preprocessed.hpp>
38 # include <boost/mpl/limits/arity.hpp>
39 # include <boost/mpl/aux_/preprocessor/params.hpp>
40 # include <boost/mpl/aux_/preprocessor/enum.hpp>
41 # include <boost/mpl/aux_/preprocessor/add.hpp>
42 # include <boost/mpl/aux_/config/dtp.hpp>
43 # include <boost/mpl/aux_/config/eti.hpp>
44 # include <boost/mpl/aux_/config/ctps.hpp>
45 # include <boost/mpl/aux_/config/msvc.hpp>
46 # include <boost/mpl/aux_/config/workaround.hpp>
48 # include <boost/preprocessor/comma_if.hpp>
49 # include <boost/preprocessor/logical/and.hpp>
50 # include <boost/preprocessor/inc.hpp>
51 # include <boost/preprocessor/iterate.hpp>
54 namespace boost { namespace mpl {
56 // local macros, #undef-ined at the end of the header
57 # define AUX778076_APPLY_WRAP_PARAMS(n, param) \
58 BOOST_MPL_PP_PARAMS(n, param) \
61 # define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \
62 BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
66 #define BOOST_PP_ITERATION_PARAMS_1 \
67 (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply_wrap.hpp>))
68 #include BOOST_PP_ITERATE()
71 # undef AUX778076_APPLY_WRAP_SPEC_PARAMS
72 # undef AUX778076_APPLY_WRAP_PARAMS
76 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
77 #endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED
79 ///// iteration, depth == 1
81 #elif BOOST_PP_ITERATION_DEPTH() == 1
83 # define i_ BOOST_PP_FRAME_ITERATION(1)
85 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
88 #define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_)
89 #define AUX778076_MSVC_DTW_ORIGINAL_NAME apply
90 #define AUX778076_MSVC_DTW_ARITY i_
91 #include <boost/mpl/aux_/msvc_dtw.hpp>
94 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
96 struct BOOST_PP_CAT(apply_wrap,i_)
98 // Metafunction forwarding confuses vc6
99 typedef typename BOOST_PP_CAT(msvc_apply,i_)<F>::template result_<
100 AUX778076_APPLY_WRAP_PARAMS(i_, T)
104 # elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
105 // MWCW/Borland version
108 int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
110 struct BOOST_PP_CAT(apply_wrap_impl,i_);
112 #define BOOST_PP_ITERATION_PARAMS_2 \
113 (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, <boost/mpl/apply_wrap.hpp>))
114 #include BOOST_PP_ITERATE()
117 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
119 struct BOOST_PP_CAT(apply_wrap,i_)
120 : BOOST_PP_CAT(apply_wrap_impl,i_)<
121 ::boost::mpl::aux::arity<F,i_>::value
123 BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
129 // ISO98 C++, with minor concession to vc7
132 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
134 , typename has_apply_ = typename aux::has_apply<F>::type
137 struct BOOST_PP_CAT(apply_wrap,i_)
138 // metafunction forwarding confuses MSVC 7.0
139 #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300)
140 : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) >
144 typedef typename F::template apply<
145 AUX778076_APPLY_WRAP_PARAMS(i_, T)
150 #if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
151 template< typename F >
152 struct BOOST_PP_CAT(apply_wrap,i_)<F,true_>
158 # endif // workarounds
160 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
161 /// workaround for ETI bug
163 struct BOOST_PP_CAT(apply_wrap,i_)<AUX778076_APPLY_WRAP_SPEC_PARAMS(i_, int)>
171 ///// iteration, depth == 2
173 #elif BOOST_PP_ITERATION_DEPTH() == 2
175 # define j_ BOOST_PP_FRAME_ITERATION(2)
178 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)
180 struct BOOST_PP_CAT(apply_wrap_impl,i_)<
181 BOOST_MPL_PP_ADD(i_, j_)
183 BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)
186 typedef typename F::template apply<
187 AUX778076_APPLY_WRAP_PARAMS(i_, T)
188 #if i_ == 0 && j_ == 0
189 /// since the defaults are "lost", we have to pass *something* even for nullary
190 /// metafunction classes
193 BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na)
200 #endif // BOOST_PP_IS_ITERATING