Defines a type that can be used to represent a set of constant values or any combination of those values. This trait is typically implemented by integer types,
std::bitset, or enumerations (scoped and unscoped) with additional operator overloads.
The bitmask type supports a finite number of bitmask elements, which are distinct non-zero values of the bitmask type, such that, for any pair Ci and Cj,
Ci & Ci is nonzero and
Ci & Cj is zero. In addition, the value
0 is used to represent an empty bitmask, with no values set.
The bitwise operators
operator^= are defined for values of the bitmask type and have the same semantics as the corresponding built-in operators on unsigned integers would have if the bitmask elements were the distinct integer powers of two.
The following expressions are well-formed and have the following meaning for any BitmaskType:
| ||sets the value Y in the object X|
| ||clears the value Y in the object X|
| ||indicates that the value Y is set in the object X|
Each representable bitmask element is defined as a
inline (since C++17)
constexpr value of the bitmask type.
The following standard library types satisfy BitmaskType:
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.