|
1 |
|
2 #if !defined(BOOST_PP_IS_ITERATING) |
|
3 |
|
4 ///// header body |
|
5 |
|
6 #ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED |
|
7 #define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED |
1 |
8 |
2 // Copyright Aleksey Gurtovoy 2000-2004 |
9 // Copyright Aleksey Gurtovoy 2000-2004 |
3 // |
10 // |
4 // Distributed under the Boost Software License, Version 1.0. |
11 // Distributed under the Boost Software License, Version 1.0. |
5 // (See accompanying file LICENSE_1_0.txt or copy at |
12 // (See accompanying file LICENSE_1_0.txt or copy at |
6 // http://www.boost.org/LICENSE_1_0.txt) |
13 // http://www.boost.org/LICENSE_1_0.txt) |
7 // |
14 // |
8 |
15 // See http://www.boost.org/libs/mpl for documentation. |
9 // Preprocessed version of "boost/mpl/apply_wrap.hpp" header |
16 |
10 // -- DO NOT modify by hand! |
17 // $Source: /cvsroot/boost/boost/boost/mpl/apply_wrap.hpp,v $ |
|
18 // $Date: 2004/09/03 15:56:55 $ |
|
19 // $Revision: 1.3 $ |
|
20 |
|
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> |
|
26 #endif |
|
27 |
|
28 #include <boost/mpl/aux_/config/use_preprocessed.hpp> |
|
29 |
|
30 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ |
|
31 && !defined(BOOST_MPL_PREPROCESSING_MODE) |
|
32 |
|
33 # define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp |
|
34 # include <boost/mpl/aux_/include_preprocessed.hpp> |
|
35 |
|
36 #else |
|
37 |
|
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> |
|
47 |
|
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> |
|
52 |
11 |
53 |
12 namespace boost { namespace mpl { |
54 namespace boost { namespace mpl { |
13 |
55 |
14 template< |
56 // local macros, #undef-ined at the end of the header |
15 typename F |
57 # define AUX778076_APPLY_WRAP_PARAMS(n, param) \ |
16 |
58 BOOST_MPL_PP_PARAMS(n, param) \ |
|
59 /**/ |
|
60 |
|
61 # define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \ |
|
62 BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \ |
|
63 /**/ |
|
64 |
|
65 |
|
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() |
|
69 |
|
70 |
|
71 # undef AUX778076_APPLY_WRAP_SPEC_PARAMS |
|
72 # undef AUX778076_APPLY_WRAP_PARAMS |
|
73 |
|
74 }} |
|
75 |
|
76 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS |
|
77 #endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED |
|
78 |
|
79 ///// iteration, depth == 1 |
|
80 |
|
81 #elif BOOST_PP_ITERATION_DEPTH() == 1 |
|
82 |
|
83 # define i_ BOOST_PP_FRAME_ITERATION(1) |
|
84 |
|
85 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) |
|
86 // MSVC version |
|
87 |
|
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> |
|
92 |
|
93 template< |
|
94 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) |
|
95 > |
|
96 struct BOOST_PP_CAT(apply_wrap,i_) |
|
97 { |
|
98 // Metafunction forwarding confuses vc6 |
|
99 typedef typename BOOST_PP_CAT(msvc_apply,i_)<F>::template result_< |
|
100 AUX778076_APPLY_WRAP_PARAMS(i_, T) |
|
101 >::type type; |
|
102 }; |
|
103 |
|
104 # elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) |
|
105 // MWCW/Borland version |
|
106 |
|
107 template< |
|
108 int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) |
|
109 > |
|
110 struct BOOST_PP_CAT(apply_wrap_impl,i_); |
|
111 |
|
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() |
|
115 |
|
116 template< |
|
117 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) |
|
118 > |
|
119 struct BOOST_PP_CAT(apply_wrap,i_) |
|
120 : BOOST_PP_CAT(apply_wrap_impl,i_)< |
|
121 ::boost::mpl::aux::arity<F,i_>::value |
|
122 , F |
|
123 BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) |
|
124 >::type |
|
125 { |
|
126 }; |
|
127 |
|
128 # else |
|
129 // ISO98 C++, with minor concession to vc7 |
|
130 |
|
131 template< |
|
132 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) |
|
133 #if i_ == 0 |
17 , typename has_apply_ = typename aux::has_apply<F>::type |
134 , typename has_apply_ = typename aux::has_apply<F>::type |
18 |
135 #endif |
19 > |
136 > |
20 struct apply_wrap0 |
137 struct BOOST_PP_CAT(apply_wrap,i_) |
21 |
138 // metafunction forwarding confuses MSVC 7.0 |
22 : F::template apply< > |
139 #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300) |
23 { |
140 : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) > |
24 }; |
141 { |
25 |
142 #else |
|
143 { |
|
144 typedef typename F::template apply< |
|
145 AUX778076_APPLY_WRAP_PARAMS(i_, T) |
|
146 >::type type; |
|
147 #endif |
|
148 }; |
|
149 |
|
150 #if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
26 template< typename F > |
151 template< typename F > |
27 struct apply_wrap0< F,true_ > |
152 struct BOOST_PP_CAT(apply_wrap,i_)<F,true_> |
28 : F::apply |
153 : F::apply |
29 { |
154 { |
30 }; |
155 }; |
31 |
156 #endif |
32 template< |
157 |
33 typename F, typename T1 |
158 # endif // workarounds |
34 |
159 |
35 > |
160 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG) |
36 struct apply_wrap1 |
161 /// workaround for ETI bug |
37 |
162 template<> |
38 : F::template apply<T1> |
163 struct BOOST_PP_CAT(apply_wrap,i_)<AUX778076_APPLY_WRAP_SPEC_PARAMS(i_, int)> |
39 { |
164 { |
40 }; |
165 typedef int type; |
41 |
166 }; |
42 template< |
167 #endif |
43 typename F, typename T1, typename T2 |
168 |
44 |
169 # undef i_ |
45 > |
170 |
46 struct apply_wrap2 |
171 ///// iteration, depth == 2 |
47 |
172 |
48 : F::template apply< T1,T2 > |
173 #elif BOOST_PP_ITERATION_DEPTH() == 2 |
49 { |
174 |
50 }; |
175 # define j_ BOOST_PP_FRAME_ITERATION(2) |
51 |
176 |
52 template< |
177 template< |
53 typename F, typename T1, typename T2, typename T3 |
178 typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) |
54 |
179 > |
55 > |
180 struct BOOST_PP_CAT(apply_wrap_impl,i_)< |
56 struct apply_wrap3 |
181 BOOST_MPL_PP_ADD(i_, j_) |
57 |
182 , F |
58 : F::template apply< T1,T2,T3 > |
183 BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) |
59 { |
184 > |
60 }; |
185 { |
61 |
186 typedef typename F::template apply< |
62 template< |
187 AUX778076_APPLY_WRAP_PARAMS(i_, T) |
63 typename F, typename T1, typename T2, typename T3, typename T4 |
188 #if i_ == 0 && j_ == 0 |
64 |
189 /// since the defaults are "lost", we have to pass *something* even for nullary |
65 > |
190 /// metafunction classes |
66 struct apply_wrap4 |
191 na |
67 |
192 #else |
68 : F::template apply< T1,T2,T3,T4 > |
193 BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na) |
69 { |
194 #endif |
70 }; |
195 > type; |
71 |
196 }; |
72 template< |
197 |
73 typename F, typename T1, typename T2, typename T3, typename T4 |
198 # undef j_ |
74 , typename T5 |
199 |
75 |
200 #endif // BOOST_PP_IS_ITERATING |
76 > |
|
77 struct apply_wrap5 |
|
78 |
|
79 : F::template apply< T1,T2,T3,T4,T5 > |
|
80 { |
|
81 }; |
|
82 |
|
83 }} |
|
84 |
|