All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HasSize.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_TYPETRAITS_HASSIZE_H_
23 #define _BLAZE_UTIL_TYPETRAITS_HASSIZE_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <blaze/util/FalseType.h>
31 #include <blaze/util/SelectType.h>
32 #include <blaze/util/TrueType.h>
33 #include <blaze/util/Types.h>
34 
35 
36 namespace blaze {
37 
38 //=================================================================================================
39 //
40 // CLASS HASSIZE
41 //
42 //=================================================================================================
43 
44 //*************************************************************************************************
62 template< typename T, size_t Size >
63 struct HasSize : public SelectType< sizeof( T ) == Size, TrueType, FalseType >::Type
64 {
65  public:
66  //**********************************************************************************************
68  enum { value = ( sizeof( T ) == Size ) };
69  typedef typename SelectType<value,TrueType,FalseType>::Type Type;
71  //**********************************************************************************************
72 };
73 //*************************************************************************************************
74 
75 
76 //*************************************************************************************************
87 template< size_t Size >
88 struct HasSize<void,Size> : public SelectType< 0 == Size, TrueType, FalseType >::Type
89 {
90  public:
91  //**********************************************************************************************
92  enum { value = ( 0 == Size ) };
93  typedef typename SelectType<value,TrueType,FalseType>::Type Type;
94  //**********************************************************************************************
95 };
97 //*************************************************************************************************
98 
99 
100 //*************************************************************************************************
111 template< size_t Size >
112 struct HasSize<const void,Size> : public SelectType< 0 == Size, TrueType, FalseType >::Type
113 {
114  public:
115  //**********************************************************************************************
116  enum { value = ( 0 == Size ) };
117  typedef typename SelectType<value,TrueType,FalseType>::Type Type;
118  //**********************************************************************************************
119 };
121 //*************************************************************************************************
122 
123 
124 //*************************************************************************************************
135 template< size_t Size >
136 struct HasSize<volatile void,Size> : public SelectType< 0 == Size, TrueType, FalseType >::Type
137 {
138  public:
139  //**********************************************************************************************
140  enum { value = ( 0 == Size ) };
141  typedef typename SelectType<value,TrueType,FalseType>::Type Type;
142  //**********************************************************************************************
143 };
145 //*************************************************************************************************
146 
147 
148 //*************************************************************************************************
159 template< size_t Size >
160 struct HasSize<const volatile void,Size> : public SelectType< 0 == Size, TrueType, FalseType >::Type
161 {
162  public:
163  //**********************************************************************************************
164  enum { value = ( 0 == Size ) };
165  typedef typename SelectType<value,TrueType,FalseType>::Type Type;
166  //**********************************************************************************************
167 };
169 //*************************************************************************************************
170 
171 
172 
173 
174 //=================================================================================================
175 //
176 // CLASS HAS1BYTE
177 //
178 //=================================================================================================
179 
180 //*************************************************************************************************
199 template< typename T >
200 struct Has1Byte : public HasSize<T,1UL>
201 {};
202 //*************************************************************************************************
203 
204 
205 
206 
207 //=================================================================================================
208 //
209 // CLASS HAS2BYTES
210 //
211 //=================================================================================================
212 
213 //*************************************************************************************************
232 template< typename T >
233 struct Has2Bytes : public HasSize<T,2UL>
234 {};
235 //*************************************************************************************************
236 
237 
238 
239 
240 //=================================================================================================
241 //
242 // CLASS HAS4BYTES
243 //
244 //=================================================================================================
245 
246 //*************************************************************************************************
265 template< typename T >
266 struct Has4Bytes : public HasSize<T,4UL>
267 {};
268 //*************************************************************************************************
269 
270 
271 
272 
273 //=================================================================================================
274 //
275 // CLASS HAS8BYTES
276 //
277 //=================================================================================================
278 
279 //*************************************************************************************************
298 template< typename T >
299 struct Has8Bytes : public HasSize<T,8UL>
300 {};
301 //*************************************************************************************************
302 
303 } // namespace blaze
304 
305 #endif