Blaze 3.9
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
47namespace blaze {
48
49//=================================================================================================
50//
51// CLASS HASSIZE
52//
53//=================================================================================================
54
55//*************************************************************************************************
74template< typename T, size_t S >
75struct HasSize
76 : public BoolConstant< sizeof( T ) == S >
77{};
78//*************************************************************************************************
79
80
81//*************************************************************************************************
92template< size_t S >
93struct HasSize<void,S>
94 : public BoolConstant< 0 == S >
95{};
97//*************************************************************************************************
98
99
100//*************************************************************************************************
111template< size_t S >
112struct HasSize<const void,S>
113 : public BoolConstant< 0 == S >
114{};
116//*************************************************************************************************
117
118
119//*************************************************************************************************
130template< size_t S >
131struct HasSize<volatile void,S>
132 : public BoolConstant< 0 == S >
133{};
135//*************************************************************************************************
136
137
138//*************************************************************************************************
149template< size_t S >
150struct HasSize<const volatile void,S>
151 : public BoolConstant< 0 == S >
152{};
154//*************************************************************************************************
155
156
157//*************************************************************************************************
170template< typename T, size_t S >
172//*************************************************************************************************
173
174
175
176
177//=================================================================================================
178//
179// CLASS HAS1BYTE
180//
181//=================================================================================================
182
183//*************************************************************************************************
202template< typename T >
204 : public HasSize<T,1UL>
205{};
206//*************************************************************************************************
207
208
209//*************************************************************************************************
222template< typename T >
224//*************************************************************************************************
225
226
227
228
229//=================================================================================================
230//
231// CLASS HAS2BYTES
232//
233//=================================================================================================
234
235//*************************************************************************************************
254template< typename T >
256 : public HasSize<T,2UL>
257{};
258//*************************************************************************************************
259
260
261//*************************************************************************************************
274template< typename T >
276//*************************************************************************************************
277
278
279
280
281//=================================================================================================
282//
283// CLASS HAS4BYTES
284//
285//=================================================================================================
286
287//*************************************************************************************************
306template< typename T >
308 : public HasSize<T,4UL>
309{};
310//*************************************************************************************************
311
312
313//*************************************************************************************************
326template< typename T >
328//*************************************************************************************************
329
330
331
332
333//=================================================================================================
334//
335// CLASS HAS8BYTES
336//
337//=================================================================================================
338
339//*************************************************************************************************
358template< typename T >
360 : public HasSize<T,8UL>
361{};
362//*************************************************************************************************
363
364
365//*************************************************************************************************
378template< typename T >
380//*************************************************************************************************
381
382} // namespace blaze
383
384#endif
Header file for the IntegralConstant class template.
constexpr bool Has1Byte_v
Auxiliary variable template for the Has1Byte type trait.
Definition: HasSize.h:223
constexpr bool Has2Bytes_v
Auxiliary variable template for the Has2Bytes type trait.
Definition: HasSize.h:275
constexpr bool HasSize_v
Auxiliary variable template for the HasSize type trait.
Definition: HasSize.h:171
constexpr bool Has8Bytes_v
Auxiliary variable template for the Has8Bytes type trait.
Definition: HasSize.h:379
constexpr bool Has4Bytes_v
Auxiliary variable template for the Has4Bytes type trait.
Definition: HasSize.h:327
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
Compile time size check.
Definition: HasSize.h:205
Compile time size check.
Definition: HasSize.h:257
Compile time size check.
Definition: HasSize.h:309
Compile time size check.
Definition: HasSize.h:361
Compile time size check.
Definition: HasSize.h:77
Generic wrapper for a compile time constant integral value.
Definition: IntegralConstant.h:74
Header file for basic type definitions.