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