fundamental_types.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_TYPE_TRAITS_FUNDAMENTAL_TYPES_HPP_
13 #define ECL_TYPE_TRAITS_FUNDAMENTAL_TYPES_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include <limits>
20 #include <ecl/mpl/bool.hpp>
21 #include <ecl/config/ecl.hpp>
22 
23 /*****************************************************************************
24 ** Namespace
25 *****************************************************************************/
26 
27 namespace ecl {
28 
29 /*****************************************************************************
30 ** Integers
31 *****************************************************************************/
40 template <typename T>
41 class is_integral : public False {};
42 
43 
49 template <>
50 class is_integral<char> : public True {};
51 
57 template <>
58 class is_integral<unsigned char> : public True {};
59 
65 template <>
66 class is_integral<short> : public True {};
67 
73 template <>
74 class is_integral<unsigned short> : public True {};
75 
81 template <>
82 class is_integral<int> : public True {};
83 
89 template <>
90 class is_integral<unsigned int> : public True {};
91 
97 template <>
98 class is_integral<long> : public True {};
99 
105 template <>
106 class is_integral<unsigned long> : public True {};
107 
113 template <>
114 class is_integral<long long> : public True {};
115 
121 template <>
122 class is_integral<unsigned long long> : public True {};
123 
124 /*****************************************************************************
125 ** Unsigned Integers
126 *****************************************************************************/
135 template <typename T>
136 class is_unsigned : public False {};
137 
141 template <>
142 class is_unsigned<unsigned char> : public True {};
143 
147 template <>
148 class is_unsigned<unsigned short> : public True {};
149 
153 template <>
154 class is_unsigned<unsigned int> : public True {};
155 
159 template <>
160 class is_unsigned<unsigned long> : public True {};
161 
165 template <>
166 class is_unsigned<unsigned long long> : public True {};
167 
168 /*****************************************************************************
169 ** Signed Integers
170 *****************************************************************************/
179 template <typename T>
180 class is_signed : public False {};
181 
185 template <>
186 class is_signed<char> : public True {};
187 
191 template <>
192 class is_signed<short> : public True {};
193 
197 template <>
198 class is_signed<int> : public True {};
199 
203 template <>
204 class is_signed<long> : public True {};
205 
209 template <>
210 class is_signed<long long> : public True {};
211 
212 
213 /*****************************************************************************
214 ** Floats
215 *****************************************************************************/
216 
225 template <typename T>
226 class is_float : public False {};
227 
233 template <>
234 class is_float<float> : public True {};
235 
241 template <>
242 class is_float<double> : public True {};
243 
249 template <>
250 class is_float<long double> : public True {};
251 
252 /*****************************************************************************
253 ** Bytes
254 *****************************************************************************/
255 
264 template <typename T>
265 class is_signed_byte : public False {};
266 
272 template <>
273 class is_signed_byte<signed char> : public True {};
274 
282 template <>
283 class is_signed_byte<char> : public Bool<std::numeric_limits<char>::is_signed> {};
284 
293 template <typename T>
294 class is_unsigned_byte : public False {};
295 
301 template <>
302 class is_unsigned_byte<unsigned char> : public True {};
303 
311 template <>
312 class is_unsigned_byte<char> : public Bool<!std::numeric_limits<char>::is_signed> {};
313 
322 template <typename T>
323 class is_byte : public False {};
324 
330 template <>
331 class is_byte<signed char> : public True {};
332 
338 template <>
339 class is_byte<char> : public True {};
340 
346 template <>
347 class is_byte<unsigned char> : public True {};
348 
349 } // namespace ecl
350 
351 #endif /* ECL_TYPE_TRAITS_FUNDAMENTAL_TYPES_HPP_ */
ecl::is_signed
Default action for detection of a signed integral type (false).
Definition: fundamental_types.hpp:186
ecl::Bool
ecl::is_unsigned
Default action for detection of an unsigned integral type (false).
Definition: fundamental_types.hpp:142
True
Bool< true > True
bool.hpp
ecl::is_float
Default action for detection of a fundamental float type (false).
Definition: fundamental_types.hpp:232
False
Bool< false > False
ecl


ecl_type_traits
Author(s): Daniel Stonier
autogenerated on Sun Aug 2 2020 03:12:07