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