Chris@16
|
1
|
Chris@16
|
2 // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
|
Chris@16
|
3
|
Chris@16
|
4 #if !defined(BOOST_PP_IS_ITERATING)
|
Chris@16
|
5
|
Chris@16
|
6 ///// header body
|
Chris@16
|
7
|
Chris@16
|
8 // Copyright Aleksey Gurtovoy 2000-2008
|
Chris@16
|
9 //
|
Chris@16
|
10 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
11 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
12 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
13 //
|
Chris@16
|
14 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
15
|
Chris@101
|
16 // $Id$
|
Chris@101
|
17 // $Date$
|
Chris@101
|
18 // $Revision$
|
Chris@16
|
19
|
Chris@16
|
20 # include <boost/mpl/aux_/config/ctps.hpp>
|
Chris@16
|
21 # include <boost/mpl/aux_/config/static_constant.hpp>
|
Chris@16
|
22 # include <boost/mpl/aux_/nttp_decl.hpp>
|
Chris@16
|
23
|
Chris@16
|
24 # include <boost/preprocessor/arithmetic/sub.hpp>
|
Chris@16
|
25 # include <boost/preprocessor/tuple/elem.hpp>
|
Chris@16
|
26 # include <boost/preprocessor/enum_params_with_a_default.hpp>
|
Chris@16
|
27 # include <boost/preprocessor/enum_params.hpp>
|
Chris@16
|
28 # include <boost/preprocessor/enum.hpp>
|
Chris@16
|
29 # include <boost/preprocessor/repeat.hpp>
|
Chris@16
|
30 # include <boost/preprocessor/comma_if.hpp>
|
Chris@16
|
31 # include <boost/preprocessor/iterate.hpp>
|
Chris@16
|
32
|
Chris@16
|
33 #if defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
34 # undef LONG_MAX
|
Chris@16
|
35 #endif
|
Chris@16
|
36
|
Chris@16
|
37 namespace boost { namespace mpl {
|
Chris@16
|
38
|
Chris@16
|
39 #if !defined(AUX778076_SEQUENCE_BASE_NAME)
|
Chris@16
|
40 # define AUX778076_SEQUENCE_BASE_NAME AUX778076_SEQUENCE_NAME
|
Chris@16
|
41 #endif
|
Chris@16
|
42
|
Chris@16
|
43 #if !defined(AUX778076_SEQUENCE_INTEGRAL_WRAPPER)
|
Chris@16
|
44
|
Chris@16
|
45 # define AUX778076_SEQUENCE_PARAM_NAME T
|
Chris@16
|
46 # define AUX778076_SEQUENCE_TEMPLATE_PARAM typename T
|
Chris@16
|
47 # define AUX778076_SEQUENCE_DEFAULT na
|
Chris@16
|
48
|
Chris@16
|
49 # define AUX778076_SEQUENCE_NAME_N(n) \
|
Chris@16
|
50 BOOST_PP_CAT(AUX778076_SEQUENCE_BASE_NAME,n) \
|
Chris@16
|
51 /**/
|
Chris@16
|
52
|
Chris@16
|
53 # define AUX778076_SEQUENCE_PARAMS() \
|
Chris@16
|
54 BOOST_PP_ENUM_PARAMS( \
|
Chris@16
|
55 AUX778076_SEQUENCE_LIMIT \
|
Chris@16
|
56 , AUX778076_SEQUENCE_TEMPLATE_PARAM \
|
Chris@16
|
57 ) \
|
Chris@16
|
58 /**/
|
Chris@16
|
59
|
Chris@16
|
60 # define AUX778076_SEQUENCE_ARGS() \
|
Chris@16
|
61 BOOST_PP_ENUM_PARAMS( \
|
Chris@16
|
62 AUX778076_SEQUENCE_LIMIT \
|
Chris@16
|
63 , T \
|
Chris@16
|
64 ) \
|
Chris@16
|
65 /**/
|
Chris@16
|
66
|
Chris@16
|
67 # define AUX778076_SEQUENCE_DEFAULT_PARAMS() \
|
Chris@16
|
68 BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \
|
Chris@16
|
69 AUX778076_SEQUENCE_LIMIT \
|
Chris@16
|
70 , AUX778076_SEQUENCE_TEMPLATE_PARAM \
|
Chris@16
|
71 , AUX778076_SEQUENCE_DEFAULT \
|
Chris@16
|
72 ) \
|
Chris@16
|
73 /**/
|
Chris@16
|
74
|
Chris@16
|
75 # define AUX778076_SEQUENCE_N_PARAMS(n) \
|
Chris@16
|
76 BOOST_PP_ENUM_PARAMS(n, AUX778076_SEQUENCE_TEMPLATE_PARAM) \
|
Chris@16
|
77 /**/
|
Chris@16
|
78
|
Chris@16
|
79 # define AUX778076_SEQUENCE_N_ARGS(n) \
|
Chris@16
|
80 BOOST_PP_ENUM_PARAMS(n, T) \
|
Chris@16
|
81 /**/
|
Chris@16
|
82
|
Chris@16
|
83 # define AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS(n) \
|
Chris@16
|
84 BOOST_PP_ENUM_PARAMS(n, T) \
|
Chris@16
|
85 BOOST_PP_COMMA_IF(n) \
|
Chris@16
|
86 BOOST_PP_ENUM( \
|
Chris@16
|
87 BOOST_PP_SUB_D(1,AUX778076_SEQUENCE_LIMIT,n) \
|
Chris@16
|
88 , BOOST_PP_TUPLE_ELEM_3_2 \
|
Chris@16
|
89 , AUX778076_SEQUENCE_DEFAULT \
|
Chris@16
|
90 ) \
|
Chris@16
|
91 /**/
|
Chris@16
|
92
|
Chris@16
|
93 #else // AUX778076_SEQUENCE_INTEGRAL_WRAPPER
|
Chris@16
|
94
|
Chris@16
|
95 # define AUX778076_SEQUENCE_PARAM_NAME C
|
Chris@16
|
96 # define AUX778076_SEQUENCE_TEMPLATE_PARAM BOOST_MPL_AUX_NTTP_DECL(long, C)
|
Chris@16
|
97 # define AUX778076_SEQUENCE_DEFAULT LONG_MAX
|
Chris@16
|
98
|
Chris@16
|
99 # define AUX778076_SEQUENCE_PARAMS() \
|
Chris@16
|
100 typename T, BOOST_PP_ENUM_PARAMS( \
|
Chris@16
|
101 AUX778076_SEQUENCE_LIMIT \
|
Chris@16
|
102 , AUX778076_SEQUENCE_TEMPLATE_PARAM \
|
Chris@16
|
103 ) \
|
Chris@16
|
104 /**/
|
Chris@16
|
105
|
Chris@16
|
106 # define AUX778076_SEQUENCE_ARGS() \
|
Chris@16
|
107 T, BOOST_PP_ENUM_PARAMS( \
|
Chris@16
|
108 AUX778076_SEQUENCE_LIMIT \
|
Chris@16
|
109 , C \
|
Chris@16
|
110 ) \
|
Chris@16
|
111 /**/
|
Chris@16
|
112
|
Chris@16
|
113 # define AUX778076_SEQUENCE_DEFAULT_PARAMS() \
|
Chris@16
|
114 typename T, \
|
Chris@16
|
115 BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \
|
Chris@16
|
116 AUX778076_SEQUENCE_LIMIT \
|
Chris@16
|
117 , AUX778076_SEQUENCE_TEMPLATE_PARAM \
|
Chris@16
|
118 , AUX778076_SEQUENCE_DEFAULT \
|
Chris@16
|
119 ) \
|
Chris@16
|
120 /**/
|
Chris@16
|
121
|
Chris@16
|
122 # define AUX778076_SEQUENCE_N_PARAMS(n) \
|
Chris@16
|
123 typename T BOOST_PP_COMMA_IF(n) \
|
Chris@16
|
124 BOOST_PP_ENUM_PARAMS(n, AUX778076_SEQUENCE_TEMPLATE_PARAM) \
|
Chris@16
|
125 /**/
|
Chris@16
|
126
|
Chris@16
|
127 # if !defined(AUX778076_SEQUENCE_CONVERT_CN_TO)
|
Chris@16
|
128 # define AUX778076_SEQUENCE_CONVERT_CN_TO(z,n,TARGET) BOOST_PP_CAT(C,n)
|
Chris@16
|
129 # endif
|
Chris@16
|
130
|
Chris@16
|
131 # define AUX778076_SEQUENCE_N_ARGS(n) \
|
Chris@16
|
132 T BOOST_PP_COMMA_IF(n) \
|
Chris@16
|
133 BOOST_PP_ENUM(n,AUX778076_SEQUENCE_CONVERT_CN_TO,T) \
|
Chris@16
|
134 /**/
|
Chris@16
|
135
|
Chris@16
|
136 # define AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS(n) \
|
Chris@16
|
137 T, BOOST_PP_ENUM_PARAMS(n, C) \
|
Chris@16
|
138 BOOST_PP_COMMA_IF(n) \
|
Chris@16
|
139 BOOST_PP_ENUM( \
|
Chris@16
|
140 BOOST_PP_SUB_D(1,AUX778076_SEQUENCE_LIMIT,n) \
|
Chris@16
|
141 , BOOST_PP_TUPLE_ELEM_3_2 \
|
Chris@16
|
142 , AUX778076_SEQUENCE_DEFAULT \
|
Chris@16
|
143 ) \
|
Chris@16
|
144 /**/
|
Chris@16
|
145
|
Chris@16
|
146 #endif // AUX778076_SEQUENCE_INTEGRAL_WRAPPER
|
Chris@16
|
147
|
Chris@16
|
148
|
Chris@16
|
149 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
150 // forward declaration
|
Chris@16
|
151 template<
|
Chris@16
|
152 AUX778076_SEQUENCE_DEFAULT_PARAMS()
|
Chris@16
|
153 >
|
Chris@16
|
154 struct AUX778076_SEQUENCE_NAME;
|
Chris@16
|
155 #else
|
Chris@16
|
156 namespace aux {
|
Chris@16
|
157 template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
|
Chris@16
|
158 struct BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_chooser);
|
Chris@16
|
159 }
|
Chris@16
|
160 #endif
|
Chris@16
|
161
|
Chris@16
|
162 #define BOOST_PP_ITERATION_PARAMS_1 \
|
Chris@16
|
163 (3,(0, AUX778076_SEQUENCE_LIMIT, <boost/mpl/aux_/sequence_wrapper.hpp>))
|
Chris@16
|
164 #include BOOST_PP_ITERATE()
|
Chris@16
|
165
|
Chris@16
|
166 // real C++ version is already taken care of
|
Chris@16
|
167 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
168
|
Chris@16
|
169 namespace aux {
|
Chris@16
|
170 // ???_count_args
|
Chris@16
|
171 #define AUX778076_COUNT_ARGS_PREFIX AUX778076_SEQUENCE_NAME
|
Chris@16
|
172 #define AUX778076_COUNT_ARGS_DEFAULT AUX778076_SEQUENCE_DEFAULT
|
Chris@16
|
173 #define AUX778076_COUNT_ARGS_PARAM_NAME AUX778076_SEQUENCE_PARAM_NAME
|
Chris@16
|
174 #define AUX778076_COUNT_ARGS_TEMPLATE_PARAM AUX778076_SEQUENCE_TEMPLATE_PARAM
|
Chris@16
|
175 #define AUX778076_COUNT_ARGS_ARITY AUX778076_SEQUENCE_LIMIT
|
Chris@16
|
176 #define AUX778076_COUNT_ARGS_USE_STANDARD_PP_PRIMITIVES
|
Chris@16
|
177 #include <boost/mpl/aux_/count_args.hpp>
|
Chris@16
|
178
|
Chris@16
|
179 template<
|
Chris@16
|
180 AUX778076_SEQUENCE_PARAMS()
|
Chris@16
|
181 >
|
Chris@16
|
182 struct BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_impl)
|
Chris@16
|
183 {
|
Chris@16
|
184 typedef aux::BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_count_args)<
|
Chris@16
|
185 BOOST_PP_ENUM_PARAMS(AUX778076_SEQUENCE_LIMIT, AUX778076_SEQUENCE_PARAM_NAME)
|
Chris@16
|
186 > arg_num_;
|
Chris@16
|
187
|
Chris@16
|
188 typedef typename aux::BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_chooser)< arg_num_::value >
|
Chris@16
|
189 ::template result_< AUX778076_SEQUENCE_ARGS() >::type type;
|
Chris@16
|
190 };
|
Chris@16
|
191
|
Chris@16
|
192 } // namespace aux
|
Chris@16
|
193
|
Chris@16
|
194 template<
|
Chris@16
|
195 AUX778076_SEQUENCE_DEFAULT_PARAMS()
|
Chris@16
|
196 >
|
Chris@16
|
197 struct AUX778076_SEQUENCE_NAME
|
Chris@16
|
198 : aux::BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_impl)<
|
Chris@16
|
199 AUX778076_SEQUENCE_ARGS()
|
Chris@16
|
200 >::type
|
Chris@16
|
201 {
|
Chris@16
|
202 typedef typename aux::BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_impl)<
|
Chris@16
|
203 AUX778076_SEQUENCE_ARGS()
|
Chris@16
|
204 >::type type;
|
Chris@16
|
205 };
|
Chris@16
|
206
|
Chris@16
|
207 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
208
|
Chris@16
|
209 # undef AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS
|
Chris@16
|
210 # undef AUX778076_SEQUENCE_N_ARGS
|
Chris@16
|
211 # undef AUX778076_SEQUENCE_CONVERT_CN_TO
|
Chris@16
|
212 # undef AUX778076_SEQUENCE_N_PARAMS
|
Chris@16
|
213 # undef AUX778076_SEQUENCE_DEFAULT_PARAMS
|
Chris@16
|
214 # undef AUX778076_SEQUENCE_ARGS
|
Chris@16
|
215 # undef AUX778076_SEQUENCE_PARAMS
|
Chris@16
|
216 # undef AUX778076_SEQUENCE_NAME_N
|
Chris@16
|
217 # undef AUX778076_SEQUENCE_DEFAULT
|
Chris@16
|
218 # undef AUX778076_SEQUENCE_TEMPLATE_PARAM
|
Chris@16
|
219 # undef AUX778076_SEQUENCE_PARAM_NAME
|
Chris@16
|
220 # undef AUX778076_SEQUENCE_LIMIT
|
Chris@16
|
221 # undef AUX778076_SEQUENCE_BASE_NAME
|
Chris@16
|
222 # undef AUX778076_SEQUENCE_NAME
|
Chris@16
|
223 # undef AUX778076_SEQUENCE_INTEGRAL_WRAPPER
|
Chris@16
|
224
|
Chris@16
|
225 }}
|
Chris@16
|
226
|
Chris@16
|
227 ///// iteration
|
Chris@16
|
228
|
Chris@16
|
229 #else
|
Chris@16
|
230 #define i_ BOOST_PP_FRAME_ITERATION(1)
|
Chris@16
|
231
|
Chris@16
|
232 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
233
|
Chris@16
|
234 #if i_ == AUX778076_SEQUENCE_LIMIT
|
Chris@16
|
235
|
Chris@16
|
236 /// primary template (not a specialization!)
|
Chris@16
|
237 template<
|
Chris@16
|
238 AUX778076_SEQUENCE_N_PARAMS(i_)
|
Chris@16
|
239 >
|
Chris@16
|
240 struct AUX778076_SEQUENCE_NAME
|
Chris@16
|
241 : AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) >
|
Chris@16
|
242 {
|
Chris@16
|
243 typedef typename AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) >::type type;
|
Chris@16
|
244 };
|
Chris@16
|
245
|
Chris@16
|
246 #else
|
Chris@16
|
247
|
Chris@16
|
248 template<
|
Chris@16
|
249 AUX778076_SEQUENCE_N_PARAMS(i_)
|
Chris@16
|
250 >
|
Chris@16
|
251 struct AUX778076_SEQUENCE_NAME< AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS(i_) >
|
Chris@16
|
252 : AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) >
|
Chris@16
|
253 {
|
Chris@16
|
254 #if i_ > 0 || defined(AUX778076_SEQUENCE_INTEGRAL_WRAPPER)
|
Chris@16
|
255 typedef typename AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) >::type type;
|
Chris@16
|
256 #else
|
Chris@16
|
257 typedef AUX778076_SEQUENCE_NAME_N(i_)< AUX778076_SEQUENCE_N_ARGS(i_) >::type type;
|
Chris@16
|
258 #endif
|
Chris@16
|
259 };
|
Chris@16
|
260
|
Chris@16
|
261 #endif // i_ == AUX778076_SEQUENCE_LIMIT
|
Chris@16
|
262
|
Chris@16
|
263 # else
|
Chris@16
|
264
|
Chris@16
|
265 namespace aux {
|
Chris@16
|
266
|
Chris@16
|
267 template<>
|
Chris@16
|
268 struct BOOST_PP_CAT(AUX778076_SEQUENCE_NAME,_chooser)<i_>
|
Chris@16
|
269 {
|
Chris@16
|
270 template<
|
Chris@16
|
271 AUX778076_SEQUENCE_PARAMS()
|
Chris@16
|
272 >
|
Chris@16
|
273 struct result_
|
Chris@16
|
274 {
|
Chris@16
|
275 #if i_ > 0 || defined(AUX778076_SEQUENCE_INTEGRAL_WRAPPER)
|
Chris@16
|
276 typedef typename AUX778076_SEQUENCE_NAME_N(i_)<
|
Chris@16
|
277 AUX778076_SEQUENCE_N_ARGS(i_)
|
Chris@16
|
278 >::type type;
|
Chris@16
|
279 #else
|
Chris@16
|
280 typedef AUX778076_SEQUENCE_NAME_N(i_)<
|
Chris@16
|
281 AUX778076_SEQUENCE_N_ARGS(i_)
|
Chris@16
|
282 >::type type;
|
Chris@16
|
283 #endif
|
Chris@16
|
284 };
|
Chris@16
|
285 };
|
Chris@16
|
286
|
Chris@16
|
287 } // namespace aux
|
Chris@16
|
288
|
Chris@16
|
289 # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
290
|
Chris@16
|
291 #undef i_
|
Chris@16
|
292 #endif // BOOST_PP_IS_ITERATING
|