HasSize.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_TYPETRAITS_HASSIZE_H_
36 #define _BLAZE_UTIL_TYPETRAITS_HASSIZE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/util/Types.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // CLASS HASSIZE
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
74 template< typename T, size_t Size >
75 struct HasSize
76  : public BoolConstant< sizeof( T ) == Size >
77 {};
78 //*************************************************************************************************
79 
80 
81 //*************************************************************************************************
92 template< size_t Size >
93 struct HasSize<void,Size>
94  : public BoolConstant< 0 == Size >
95 {};
97 //*************************************************************************************************
98 
99 
100 //*************************************************************************************************
111 template< size_t Size >
112 struct HasSize<const void,Size>
113  : public BoolConstant< 0 == Size >
114 {};
116 //*************************************************************************************************
117 
118 
119 //*************************************************************************************************
130 template< size_t Size >
131 struct HasSize<volatile void,Size>
132  : public BoolConstant< 0 == Size >
133 {};
135 //*************************************************************************************************
136 
137 
138 //*************************************************************************************************
149 template< size_t Size >
150 struct HasSize<const volatile void,Size>
151  : public BoolConstant< 0 == Size >
152 {};
154 //*************************************************************************************************
155 
156 
157 
158 
159 //=================================================================================================
160 //
161 // CLASS HAS1BYTE
162 //
163 //=================================================================================================
164 
165 //*************************************************************************************************
184 template< typename T >
185 struct Has1Byte
186  : public HasSize<T,1UL>
187 {};
188 //*************************************************************************************************
189 
190 
191 
192 
193 //=================================================================================================
194 //
195 // CLASS HAS2BYTES
196 //
197 //=================================================================================================
198 
199 //*************************************************************************************************
218 template< typename T >
219 struct Has2Bytes
220  : public HasSize<T,2UL>
221 {};
222 //*************************************************************************************************
223 
224 
225 
226 
227 //=================================================================================================
228 //
229 // CLASS HAS4BYTES
230 //
231 //=================================================================================================
232 
233 //*************************************************************************************************
252 template< typename T >
253 struct Has4Bytes
254  : public HasSize<T,4UL>
255 {};
256 //*************************************************************************************************
257 
258 
259 
260 
261 //=================================================================================================
262 //
263 // CLASS HAS8BYTES
264 //
265 //=================================================================================================
266 
267 //*************************************************************************************************
286 template< typename T >
287 struct Has8Bytes
288  : public HasSize<T,8UL>
289 {};
290 //*************************************************************************************************
291 
292 } // namespace blaze
293 
294 #endif
Header file for basic type definitions.
Compile time size check.This type trait offers the possibility to test whether a given type has a siz...
Definition: HasSize.h:185
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Compile time size check.This class offers the possibility to test the size of a type at compile time...
Definition: HasSize.h:75
Compile time size check.This type trait offers the possibility to test whether a given type has a siz...
Definition: HasSize.h:219
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Compile time size check.This type trait offers the possibility to test whether a given type has a siz...
Definition: HasSize.h:253
Compile time size check.This type trait offers the possibility to test whether a given type has a siz...
Definition: HasSize.h:287
Header file for the IntegralConstant class template.