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