common_arithmetic_type.hpp
Go to the documentation of this file.
1 #ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_ARITHMETIC_TYPE_HPP_INCLUDED
2 #define BOOST_TYPE_TRAITS_DETAIL_COMMON_ARITHMETIC_TYPE_HPP_INCLUDED
3 
4 //
5 // Copyright 2015 Peter Dimov
6 //
7 // Distributed under the Boost Software License, Version 1.0.
8 // See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt
10 //
11 
12 #include <boost/config.hpp>
13 
14 namespace boost
15 {
16 
17 namespace type_traits_detail
18 {
19 
20 template<int I> struct arithmetic_type;
21 
22 // Types bool, char, char16_t, char32_t, wchar_t,
23 // and the signed and unsigned integer types are
24 // collectively called integral types
25 
26 template<> struct arithmetic_type<1>
27 {
28  typedef bool type;
29  typedef char (&result_type) [1];
30 };
31 
32 template<> struct arithmetic_type<2>
33 {
34  typedef char type;
35  typedef char (&result_type) [2];
36 };
37 
38 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
39 
40 template<> struct arithmetic_type<3>
41 {
42  typedef wchar_t type;
43  typedef char (&result_type) [3];
44 };
45 
46 #endif
47 
48 // There are five standard signed integer types:
49 // "signed char", "short int", "int", "long int", and "long long int".
50 
51 template<> struct arithmetic_type<4>
52 {
53  typedef signed char type;
54  typedef char (&result_type) [4];
55 };
56 
57 template<> struct arithmetic_type<5>
58 {
59  typedef short type;
60  typedef char (&result_type) [5];
61 };
62 
63 template<> struct arithmetic_type<6>
64 {
65  typedef int type;
66  typedef char (&result_type) [6];
67 };
68 
69 template<> struct arithmetic_type<7>
70 {
71  typedef long type;
72  typedef char (&result_type) [7];
73 };
74 
75 template<> struct arithmetic_type<8>
76 {
77  typedef boost::long_long_type type;
78  typedef char (&result_type) [8];
79 };
80 
81 // For each of the standard signed integer types, there exists a corresponding
82 // (but different) standard unsigned integer type: "unsigned char", "unsigned short int",
83 // "unsigned int", "unsigned long int", and "unsigned long long int"
84 
85 template<> struct arithmetic_type<9>
86 {
87  typedef unsigned char type;
88  typedef char (&result_type) [9];
89 };
90 
91 template<> struct arithmetic_type<10>
92 {
93  typedef unsigned short type;
94  typedef char (&result_type) [10];
95 };
96 
97 template<> struct arithmetic_type<11>
98 {
99  typedef unsigned int type;
100  typedef char (&result_type) [11];
101 };
102 
103 template<> struct arithmetic_type<12>
104 {
105  typedef unsigned long type;
106  typedef char (&result_type) [12];
107 };
108 
109 template<> struct arithmetic_type<13>
110 {
111  typedef boost::ulong_long_type type;
112  typedef char (&result_type) [13];
113 };
114 
115 // There are three floating point types: float, double, and long double.
116 
117 template<> struct arithmetic_type<14>
118 {
119  typedef float type;
120  typedef char (&result_type) [14];
121 };
122 
123 template<> struct arithmetic_type<15>
124 {
125  typedef double type;
126  typedef char (&result_type) [15];
127 };
128 
129 template<> struct arithmetic_type<16>
130 {
131  typedef long double type;
132  typedef char (&result_type) [16];
133 };
134 
135 #if !defined( BOOST_NO_CXX11_CHAR16_T )
136 
137 template<> struct arithmetic_type<17>
138 {
139  typedef char16_t type;
140  typedef char (&result_type) [17];
141 };
142 
143 #endif
144 
145 #if !defined( BOOST_NO_CXX11_CHAR32_T )
146 
147 template<> struct arithmetic_type<18>
148 {
149  typedef char32_t type;
150  typedef char (&result_type) [18];
151 };
152 
153 #endif
154 
155 #if defined( BOOST_HAS_INT128 )
156 
157 template<> struct arithmetic_type<19>
158 {
159  typedef boost::int128_type type;
160  typedef char (&result_type) [19];
161 };
162 
163 template<> struct arithmetic_type<20>
164 {
165  typedef boost::uint128_type type;
166  typedef char (&result_type) [20];
167 };
168 
169 #endif
170 
171 template<class T, class U> class common_arithmetic_type
172 {
173 private:
174 
177 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
179 #endif
193 
194 #if !defined( BOOST_NO_CXX11_CHAR16_T )
196 #endif
197 
198 #if !defined( BOOST_NO_CXX11_CHAR32_T )
200 #endif
201 
202 #if defined( BOOST_HAS_INT128 )
205 #endif
206 
207  static bool cond();
208 
209 public:
210 
211  typedef typename arithmetic_type< sizeof(select( cond()? T(): U() )) >::type type;
212 };
213 
214 } // namespace type_traits_detail
215 
216 } // namespace boost
217 
218 #endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_ARITHMETIC_TYPE_HPP_INCLUDED
boost::type_traits_detail::arithmetic_type< 7 >::type
long type
Definition: common_arithmetic_type.hpp:71
boost::type_traits_detail::arithmetic_type< 3 >::type
wchar_t type
Definition: common_arithmetic_type.hpp:42
boost::type_traits_detail::arithmetic_type
Definition: common_arithmetic_type.hpp:20
boost::type_traits_detail::arithmetic_type< 2 >::type
char type
Definition: common_arithmetic_type.hpp:34
boost::type_traits_detail::arithmetic_type< 17 >::type
char16_t type
Definition: common_arithmetic_type.hpp:139
config.hpp
boost::type_traits_detail::arithmetic_type< 6 >::type
int type
Definition: common_arithmetic_type.hpp:65
boost::type_traits_detail::arithmetic_type< 14 >::type
float type
Definition: common_arithmetic_type.hpp:119
boost::type_traits_detail::arithmetic_type< 4 >::type
signed char type
Definition: common_arithmetic_type.hpp:53
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
Definition: core/addressof.hpp:19
boost::type_traits_detail::common_arithmetic_type::select
static arithmetic_type< 1 >::result_type select(arithmetic_type< 1 >::type)
boost::type_traits_detail::arithmetic_type< 15 >::type
double type
Definition: common_arithmetic_type.hpp:125
boost::type_traits_detail::arithmetic_type< 5 >::type
short type
Definition: common_arithmetic_type.hpp:59
boost::type_traits_detail::arithmetic_type< 16 >::type
long double type
Definition: common_arithmetic_type.hpp:131
boost::type_traits_detail::arithmetic_type< 12 >::type
unsigned long type
Definition: common_arithmetic_type.hpp:105
type
GLenum type
Definition: glad/glad/glad.h:135
boost::type_traits_detail::common_arithmetic_type::cond
static bool cond()
boost::type_traits_detail::common_arithmetic_type
Definition: common_arithmetic_type.hpp:171
t265_stereo.T
T
Definition: t265_stereo.py:157
boost::type_traits_detail::arithmetic_type< 10 >::type
unsigned short type
Definition: common_arithmetic_type.hpp:93
boost::type_traits_detail::arithmetic_type< 9 >::type
unsigned char type
Definition: common_arithmetic_type.hpp:87
boost::type_traits_detail::arithmetic_type< 8 >::type
boost::long_long_type type
Definition: common_arithmetic_type.hpp:77
boost::type_traits_detail::arithmetic_type< 11 >::type
unsigned int type
Definition: common_arithmetic_type.hpp:99
boost::type_traits_detail::common_arithmetic_type::type
arithmetic_type< sizeof(select(cond()? T():U())) >::type type
Definition: common_arithmetic_type.hpp:211
boost::type_traits_detail::arithmetic_type< 18 >::type
char32_t type
Definition: common_arithmetic_type.hpp:149
boost::type_traits_detail::arithmetic_type< 1 >::type
bool type
Definition: common_arithmetic_type.hpp:28
boost::type_traits_detail::arithmetic_type< 13 >::type
boost::ulong_long_type type
Definition: common_arithmetic_type.hpp:111


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Thu Dec 22 2022 03:13:15