ome-common
5.2.0
|
Boolean type with guaranteed size, alignment and storage values. More...
#include <ome/common/boolean.h>
Public Types | |
typedef uint8_t | value_type |
Value type for Boolean values. | |
Public Member Functions | |
boolean () | |
Default construct. More... | |
boolean (bool value) | |
Construct with initial value. More... | |
boolean (const boolean &value) | |
Copy construct. More... | |
operator bool () const | |
Cast to bool . More... | |
boolean & | operator= (bool rhs) |
Assign value. More... | |
boolean & | operator= (const boolean &rhs) |
Assign value. More... | |
boolean | operator! () const |
Not operator. More... | |
Private Attributes | |
uint8_t | value |
The boolean value. | |
Boolean type with guaranteed size, alignment and storage values.
The standard bool
type has an implementation-defined size, and as such this makes it unsuitable for interoperability with some APIs and libraries when used in arrays and matrices where the size and alignment are required to meet specific criteria. The special-casing of bool
for some standard library containers is an additional complication where direct addressing and safe iteration and modification are required.
This type is compatible with bool
, but is defined in terms of uint8_t
, and so is 8 bits in size. It should have the same alignment requirements (i.e. on byte boundaries as for char
) and so should permit tight packing and unaligned access. Its value is all bits zero (false, 0x00) or all bits one (true, 0xFF), making it suitable for direct logical masking operations with 8-bit data or as a normalized GL texture, for example.
|
inline |
Default construct.
The default value is false
.
|
inline |
Construct with initial value.
value | the initial value. |
|
inline |
Copy construct.
value | the value to copy. |
|
inline |
|
inline |
Not operator.
|
inline |