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 : public BoolConstant< sizeof( T ) == Size >
76 {};
77 //*************************************************************************************************
78 
79 
80 //*************************************************************************************************
91 template< size_t Size >
92 struct HasSize<void,Size> : public BoolConstant< 0 == Size >
93 {};
95 //*************************************************************************************************
96 
97 
98 //*************************************************************************************************
109 template< size_t Size >
110 struct HasSize<const void,Size> : public BoolConstant< 0 == Size >
111 {};
113 //*************************************************************************************************
114 
115 
116 //*************************************************************************************************
127 template< size_t Size >
128 struct HasSize<volatile void,Size> : public BoolConstant< 0 == Size >
129 {};
131 //*************************************************************************************************
132 
133 
134 //*************************************************************************************************
145 template< size_t Size >
146 struct HasSize<const volatile void,Size> : public BoolConstant< 0 == Size >
147 {};
149 //*************************************************************************************************
150 
151 
152 
153 
154 //=================================================================================================
155 //
156 // CLASS HAS1BYTE
157 //
158 //=================================================================================================
159 
160 //*************************************************************************************************
179 template< typename T >
180 struct Has1Byte : public HasSize<T,1UL>
181 {};
182 //*************************************************************************************************
183 
184 
185 
186 
187 //=================================================================================================
188 //
189 // CLASS HAS2BYTES
190 //
191 //=================================================================================================
192 
193 //*************************************************************************************************
212 template< typename T >
213 struct Has2Bytes : public HasSize<T,2UL>
214 {};
215 //*************************************************************************************************
216 
217 
218 
219 
220 //=================================================================================================
221 //
222 // CLASS HAS4BYTES
223 //
224 //=================================================================================================
225 
226 //*************************************************************************************************
245 template< typename T >
246 struct Has4Bytes : public HasSize<T,4UL>
247 {};
248 //*************************************************************************************************
249 
250 
251 
252 
253 //=================================================================================================
254 //
255 // CLASS HAS8BYTES
256 //
257 //=================================================================================================
258 
259 //*************************************************************************************************
278 template< typename T >
279 struct Has8Bytes : public HasSize<T,8UL>
280 {};
281 //*************************************************************************************************
282 
283 } // namespace blaze
284 
285 #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:180
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:213
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:246
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
Compile time size check.This type trait offers the possibility to test whether a given type has a siz...
Definition: HasSize.h:279
Compile time evaluation of the size of a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:75
Header file for the IntegralConstant class template.