Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/support/numeric_traits.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 // Copyright (c) 2001-2011 Hartmut Kaiser | |
2 // | |
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | |
6 #if !defined(BOOST_SPIRIT_NUMERIC_TRAITS_JAN_07_2011_0722AM) | |
7 #define BOOST_SPIRIT_NUMERIC_TRAITS_JAN_07_2011_0722AM | |
8 | |
9 #if defined(_MSC_VER) | |
10 #pragma once | |
11 #endif | |
12 | |
13 #include <boost/config.hpp> | |
14 #include <boost/mpl/bool.hpp> | |
15 #include <boost/integer_traits.hpp> | |
16 #include <boost/utility/enable_if.hpp> | |
17 | |
18 namespace boost { namespace spirit { namespace traits | |
19 { | |
20 /////////////////////////////////////////////////////////////////////////// | |
21 // Determine if T is a boolean type | |
22 /////////////////////////////////////////////////////////////////////////// | |
23 template <typename T> | |
24 struct is_bool : mpl::false_ {}; | |
25 | |
26 template <typename T> | |
27 struct is_bool<T const> : is_bool<T> {}; | |
28 | |
29 template <> | |
30 struct is_bool<bool> : mpl::true_ {}; | |
31 | |
32 /////////////////////////////////////////////////////////////////////////// | |
33 // Determine if T is a signed integer type | |
34 /////////////////////////////////////////////////////////////////////////// | |
35 template <typename T> | |
36 struct is_int : mpl::false_ {}; | |
37 | |
38 template <typename T> | |
39 struct is_int<T const> : is_int<T> {}; | |
40 | |
41 template <> | |
42 struct is_int<short> : mpl::true_ {}; | |
43 | |
44 template <> | |
45 struct is_int<int> : mpl::true_ {}; | |
46 | |
47 template <> | |
48 struct is_int<long> : mpl::true_ {}; | |
49 | |
50 #ifdef BOOST_HAS_LONG_LONG | |
51 template <> | |
52 struct is_int<boost::long_long_type> : mpl::true_ {}; | |
53 #endif | |
54 | |
55 /////////////////////////////////////////////////////////////////////////// | |
56 // Determine if T is an unsigned integer type | |
57 /////////////////////////////////////////////////////////////////////////// | |
58 template <typename T> | |
59 struct is_uint : mpl::false_ {}; | |
60 | |
61 template <typename T> | |
62 struct is_uint<T const> : is_uint<T> {}; | |
63 | |
64 #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) | |
65 template <> | |
66 struct is_uint<unsigned short> : mpl::true_ {}; | |
67 #endif | |
68 | |
69 template <> | |
70 struct is_uint<unsigned int> : mpl::true_ {}; | |
71 | |
72 template <> | |
73 struct is_uint<unsigned long> : mpl::true_ {}; | |
74 | |
75 #ifdef BOOST_HAS_LONG_LONG | |
76 template <> | |
77 struct is_uint<boost::ulong_long_type> : mpl::true_ {}; | |
78 #endif | |
79 | |
80 /////////////////////////////////////////////////////////////////////////// | |
81 // Determine if T is a floating point type | |
82 /////////////////////////////////////////////////////////////////////////// | |
83 template <typename T> | |
84 struct is_real : mpl::false_ {}; | |
85 | |
86 template <typename T> | |
87 struct is_real<T const> : is_uint<T> {}; | |
88 | |
89 template <> | |
90 struct is_real<float> : mpl::true_ {}; | |
91 | |
92 template <> | |
93 struct is_real<double> : mpl::true_ {}; | |
94 | |
95 template <> | |
96 struct is_real<long double> : mpl::true_ {}; | |
97 | |
98 /////////////////////////////////////////////////////////////////////////// | |
99 // customization points for numeric operations | |
100 /////////////////////////////////////////////////////////////////////////// | |
101 template <typename T, typename Enable = void> | |
102 struct absolute_value; | |
103 | |
104 template <typename T, typename Enable = void> | |
105 struct is_negative; | |
106 | |
107 template <typename T, typename Enable = void> | |
108 struct is_zero; | |
109 | |
110 template <typename T, typename Enable = void> | |
111 struct pow10_helper; | |
112 | |
113 template <typename T, typename Enable = void> | |
114 struct is_nan; | |
115 | |
116 template <typename T, typename Enable = void> | |
117 struct is_infinite; | |
118 | |
119 template <typename T, typename Enable = void> | |
120 struct is_integer_wrapping : mpl::false_ {}; | |
121 | |
122 template <typename T> | |
123 struct is_integer_wrapping_default | |
124 : mpl::bool_<(static_cast<T>(integer_traits<T>::const_max + 1) == integer_traits<T>::const_min)> {}; | |
125 | |
126 template <typename T> | |
127 struct is_integer_wrapping<T, typename enable_if_c<integer_traits<T>::is_integral>::type> | |
128 : is_integer_wrapping_default<T> {}; | |
129 }}} | |
130 | |
131 #endif |