1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
|
#if !defined(BOOST_PP_IS_ITERATING)
///// header body
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION!
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id: numeric_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $
// $Revision: 49267 $
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/numeric_cast.hpp>
# include <boost/mpl/apply_wrap.hpp>
# include <boost/mpl/if.hpp>
# include <boost/mpl/tag.hpp>
# include <boost/mpl/aux_/numeric_cast_utils.hpp>
# include <boost/mpl/aux_/na.hpp>
# include <boost/mpl/aux_/na_spec.hpp>
# include <boost/mpl/aux_/lambda_support.hpp>
# include <boost/mpl/aux_/msvc_eti_base.hpp>
# include <boost/mpl/aux_/value_wknd.hpp>
# include <boost/mpl/aux_/config/eti.hpp>
# include <boost/mpl/aux_/nttp_decl.hpp>
#endif
#include <boost/mpl/aux_/config/static_constant.hpp>
#if defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|| defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/limits/arity.hpp>
# include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
# include <boost/mpl/aux_/preprocessor/def_params_tail.hpp>
# include <boost/mpl/aux_/preprocessor/repeat.hpp>
# include <boost/mpl/aux_/preprocessor/ext_params.hpp>
# include <boost/mpl/aux_/preprocessor/params.hpp>
# include <boost/mpl/aux_/preprocessor/enum.hpp>
# include <boost/mpl/aux_/preprocessor/add.hpp>
# include <boost/mpl/aux_/preprocessor/sub.hpp>
# include <boost/mpl/aux_/config/ctps.hpp>
# include <boost/mpl/aux_/config/eti.hpp>
# include <boost/mpl/aux_/config/msvc.hpp>
# include <boost/mpl/aux_/config/workaround.hpp>
# include <boost/preprocessor/dec.hpp>
# include <boost/preprocessor/inc.hpp>
# include <boost/preprocessor/iterate.hpp>
# include <boost/preprocessor/cat.hpp>
#if !defined(AUX778076_OP_ARITY)
# define AUX778076_OP_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
#endif
#if !defined(AUX778076_OP_IMPL_NAME)
# define AUX778076_OP_IMPL_NAME BOOST_PP_CAT(AUX778076_OP_PREFIX,_impl)
#endif
#if !defined(AUX778076_OP_TAG_NAME)
# define AUX778076_OP_TAG_NAME BOOST_PP_CAT(AUX778076_OP_PREFIX,_tag)
#endif
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
, BOOST_MPL_AUX_NTTP_DECL(int, tag1_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value
, BOOST_MPL_AUX_NTTP_DECL(int, tag2_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value
>
struct AUX778076_OP_IMPL_NAME
: if_c<
( tag1_ > tag2_ )
#else
>
struct AUX778076_OP_IMPL_NAME
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
#endif
, aux::cast2nd_impl< AUX778076_OP_IMPL_NAME<Tag1,Tag1>,Tag1,Tag2 >
, aux::cast1st_impl< AUX778076_OP_IMPL_NAME<Tag2,Tag2>,Tag1,Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct AUX778076_OP_IMPL_NAME<na,na>
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template< typename Tag > struct AUX778076_OP_IMPL_NAME<na,Tag>
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct AUX778076_OP_IMPL_NAME<Tag,na>
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
#else
template<> struct AUX778076_OP_IMPL_NAME<na,integral_c_tag>
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template<> struct AUX778076_OP_IMPL_NAME<integral_c_tag,na>
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
#endif
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& BOOST_WORKAROUND(BOOST_MSVC, >= 1300)
template< typename T > struct AUX778076_OP_TAG_NAME
: tag<T,na>
{
};
#else
template< typename T > struct AUX778076_OP_TAG_NAME
{
typedef typename T::tag type;
};
#endif
#if AUX778076_OP_ARITY != 2
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
# define AUX778076_OP_RIGHT_OPERAND(unused, i, N) , BOOST_PP_CAT(N, BOOST_MPL_PP_ADD(i, 2))>
# define AUX778076_OP_N_CALLS(i, N) \
BOOST_MPL_PP_REPEAT( BOOST_PP_DEC(i), BOOST_MPL_PP_REPEAT_IDENTITY_FUNC, AUX778076_OP_NAME< ) \
N1 BOOST_MPL_PP_REPEAT( BOOST_MPL_PP_SUB(i, 1), AUX778076_OP_RIGHT_OPERAND, N ) \
/**/
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
BOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename N, na)
>
struct AUX778076_OP_NAME
: AUX778076_OP_N_CALLS(AUX778076_OP_ARITY, N)
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
AUX778076_OP_ARITY
, AUX778076_OP_NAME
, ( BOOST_MPL_PP_PARAMS(AUX778076_OP_ARITY, N) )
)
};
#define BOOST_PP_ITERATION_PARAMS_1 \
(3,( BOOST_PP_DEC(AUX778076_OP_ARITY), 2, <boost/mpl/aux_/numeric_op.hpp> ))
#include BOOST_PP_ITERATE()
# undef AUX778076_OP_N_CALLS
# undef AUX778076_OP_RIGHT_OPERAND
# else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
/// forward declaration
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct BOOST_PP_CAT(AUX778076_OP_NAME,2);
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
BOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename N, na)
>
struct AUX778076_OP_NAME
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
: aux::msvc_eti_base< typename if_<
#else
: if_<
#endif
is_na<N3>
, BOOST_PP_CAT(AUX778076_OP_NAME,2)<N1,N2>
, AUX778076_OP_NAME<
BOOST_PP_CAT(AUX778076_OP_NAME,2)<N1,N2>
, BOOST_MPL_PP_EXT_PARAMS(3, BOOST_PP_INC(AUX778076_OP_ARITY), N)
>
>::type
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
>
#endif
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
AUX778076_OP_ARITY
, AUX778076_OP_NAME
, ( BOOST_MPL_PP_PARAMS(AUX778076_OP_ARITY, N) )
)
};
template<
typename N1
, typename N2
>
struct BOOST_PP_CAT(AUX778076_OP_NAME,2)
#endif
#else // AUX778076_OP_ARITY == 2
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct AUX778076_OP_NAME
#endif
#if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
: AUX778076_OP_IMPL_NAME<
typename AUX778076_OP_TAG_NAME<N1>::type
, typename AUX778076_OP_TAG_NAME<N2>::type
>::template apply<N1,N2>::type
#else
: aux::msvc_eti_base< typename apply_wrap2<
AUX778076_OP_IMPL_NAME<
typename AUX778076_OP_TAG_NAME<N1>::type
, typename AUX778076_OP_TAG_NAME<N2>::type
>
, N1
, N2
>::type >::type
#endif
{
#if AUX778076_OP_ARITY != 2
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
AUX778076_OP_ARITY
, AUX778076_OP_NAME
, ( BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(2, N, na) )
)
# else
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, BOOST_PP_CAT(AUX778076_OP_NAME,2), (N1, N2))
# endif
#else
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, AUX778076_OP_NAME, (N1, N2))
#endif
};
BOOST_MPL_AUX_NA_SPEC2(2, AUX778076_OP_ARITY, AUX778076_OP_NAME)
}}
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
///// iteration, depth == 1
// For gcc 4.4 compatability, we must include the
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
#else // BOOST_PP_IS_ITERATING
#if BOOST_PP_ITERATION_DEPTH() == 1
# define i_ BOOST_PP_FRAME_ITERATION(1)
template<
BOOST_MPL_PP_PARAMS(i_, typename N)
>
struct AUX778076_OP_NAME<BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(i_, N, na)>
#if i_ != 2
: AUX778076_OP_N_CALLS(i_, N)
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
AUX778076_OP_ARITY
, AUX778076_OP_NAME
, ( BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(i_, N, na) )
)
};
#endif
# undef i_
#endif // BOOST_PP_ITERATION_DEPTH()
#endif // BOOST_PP_IS_ITERATING
|