Chris@16
|
1 //
|
Chris@16
|
2 //! Copyright (c) 2011-2012
|
Chris@16
|
3 //! Brandon Kohn
|
Chris@16
|
4 //
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
6 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8 //
|
Chris@16
|
9
|
Chris@16
|
10 #if !defined(BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES)
|
Chris@16
|
11
|
Chris@16
|
12 #include <boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp>
|
Chris@16
|
13
|
Chris@16
|
14 #if !defined(BOOST_NO_LONG_LONG)
|
Chris@16
|
15 #include <boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp>
|
Chris@16
|
16 #endif
|
Chris@16
|
17
|
Chris@16
|
18 #else
|
Chris@16
|
19 #if !BOOST_PP_IS_ITERATING
|
Chris@16
|
20
|
Chris@16
|
21 #include <boost/preprocessor/seq/elem.hpp>
|
Chris@16
|
22 #include <boost/preprocessor/seq/size.hpp>
|
Chris@16
|
23 #include <boost/preprocessor/iteration/iterate.hpp>
|
Chris@16
|
24
|
Chris@16
|
25 #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
26 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_common.hpp")
|
Chris@16
|
27 #endif
|
Chris@16
|
28 //
|
Chris@16
|
29 //! Copyright (c) 2011-2012
|
Chris@16
|
30 //! Brandon Kohn
|
Chris@16
|
31 //
|
Chris@16
|
32 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
33 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
34 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
35 //
|
Chris@16
|
36 #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
37 #pragma wave option(preserve: 1)
|
Chris@16
|
38 #endif
|
Chris@16
|
39
|
Chris@16
|
40 //! These are the assumed common built in fundamental types (not typedefs/macros.)
|
Chris@16
|
41 #define BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() \
|
Chris@16
|
42 (char) \
|
Chris@16
|
43 (signed char) \
|
Chris@16
|
44 (unsigned char) \
|
Chris@16
|
45 (short) \
|
Chris@16
|
46 (unsigned short) \
|
Chris@16
|
47 (int) \
|
Chris@16
|
48 (unsigned int) \
|
Chris@16
|
49 (long) \
|
Chris@16
|
50 (unsigned long) \
|
Chris@16
|
51 (float) \
|
Chris@16
|
52 (double) \
|
Chris@16
|
53 (long double) \
|
Chris@16
|
54 /***/
|
Chris@16
|
55
|
Chris@16
|
56 #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()
|
Chris@16
|
57 #define BOOST_NUMERIC_CONVERSION_SEQ_B() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()
|
Chris@16
|
58
|
Chris@16
|
59 namespace boost { namespace numeric {
|
Chris@16
|
60
|
Chris@16
|
61 #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>))
|
Chris@16
|
62 #include BOOST_PP_ITERATE()
|
Chris@16
|
63
|
Chris@16
|
64 }}//namespace boost::numeric;
|
Chris@16
|
65
|
Chris@16
|
66 #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
67 #pragma wave option(output: null)
|
Chris@16
|
68 #endif
|
Chris@16
|
69
|
Chris@16
|
70 #if ( defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) ) || !defined(BOOST_NO_LONG_LONG)
|
Chris@16
|
71
|
Chris@16
|
72 #undef BOOST_NUMERIC_CONVERSION_SEQ_A
|
Chris@16
|
73 #undef BOOST_NUMERIC_CONVERSION_SEQ_B
|
Chris@16
|
74
|
Chris@16
|
75 #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
76 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_long_long.hpp")
|
Chris@16
|
77 #endif
|
Chris@16
|
78
|
Chris@16
|
79 //
|
Chris@16
|
80 //! Copyright (c) 2011-2012
|
Chris@16
|
81 //! Brandon Kohn
|
Chris@16
|
82 //
|
Chris@16
|
83 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
84 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
85 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
86 //
|
Chris@16
|
87 #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
88 #pragma wave option(preserve: 1)
|
Chris@16
|
89 #endif
|
Chris@16
|
90
|
Chris@16
|
91 namespace boost { namespace numeric {
|
Chris@16
|
92
|
Chris@16
|
93 #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()(boost::long_long_type)(boost::ulong_long_type)
|
Chris@16
|
94 #define BOOST_NUMERIC_CONVERSION_SEQ_B() (boost::long_long_type)(boost::ulong_long_type)
|
Chris@16
|
95
|
Chris@16
|
96 #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>))
|
Chris@16
|
97 #include BOOST_PP_ITERATE()
|
Chris@16
|
98
|
Chris@16
|
99 }}//namespace boost::numeric;
|
Chris@16
|
100
|
Chris@16
|
101 #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
102 #pragma wave option(output: null)
|
Chris@16
|
103 #endif
|
Chris@16
|
104
|
Chris@16
|
105 #endif
|
Chris@16
|
106
|
Chris@16
|
107 #undef BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES
|
Chris@16
|
108 #undef BOOST_NUMERIC_CONVERSION_SEQ_A
|
Chris@16
|
109 #undef BOOST_NUMERIC_CONVERSION_SEQ_B
|
Chris@16
|
110
|
Chris@16
|
111 #elif BOOST_PP_ITERATION_DEPTH() == 1
|
Chris@16
|
112
|
Chris@16
|
113 #define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_B())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>))
|
Chris@16
|
114 #include BOOST_PP_ITERATE()
|
Chris@16
|
115
|
Chris@16
|
116 #elif BOOST_PP_ITERATION_DEPTH() == 2
|
Chris@16
|
117
|
Chris@16
|
118 //! Generate default traits for the specified source and target.
|
Chris@16
|
119 #define BOOST_NUMERIC_CONVERSION_A BOOST_PP_FRAME_ITERATION(1)
|
Chris@16
|
120 #define BOOST_NUMERIC_CONVERSION_B BOOST_PP_FRAME_ITERATION(2)
|
Chris@16
|
121
|
Chris@16
|
122 template <>
|
Chris@16
|
123 struct numeric_cast_traits
|
Chris@16
|
124 <
|
Chris@16
|
125 BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_A, BOOST_NUMERIC_CONVERSION_SEQ_A())
|
Chris@16
|
126 , BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B())
|
Chris@16
|
127 >
|
Chris@16
|
128 {
|
Chris@16
|
129 typedef def_overflow_handler overflow_policy;
|
Chris@16
|
130 typedef UseInternalRangeChecker range_checking_policy;
|
Chris@16
|
131 typedef Trunc<BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B())> rounding_policy;
|
Chris@16
|
132 };
|
Chris@16
|
133
|
Chris@16
|
134 #undef BOOST_NUMERIC_CONVERSION_A
|
Chris@16
|
135 #undef BOOST_NUMERIC_CONVERSION_B
|
Chris@16
|
136
|
Chris@16
|
137 #endif//! Depth 2.
|
Chris@16
|
138 #endif// BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES
|