18 #ifndef FLAG_ARRAY_HH_ 19 #define FLAG_ARRAY_HH_ 47 template <
class Tag,
int Size = 32>
67 constexpr
Mask() =
default;
70 constexpr
Mask(BitField mask, BitField
set)
80 constexpr
Mask(BitField mask)
102 constexpr
bool match(BitField flags)
const 113 static constexpr BitField
mask_set( BitField set1, BitField mask2, BitField set2)
114 {
return (mask2 & set2) | (~mask2 & set1);
122 template <
class T,
int S>
129 static const unsigned int size = Size;
164 {
return mask.match(
flags_); }
BitField mask_
The mask operates only on true bits of the mask_ member.
friend std::ostream & operator<<(std::ostream &s, const FlagArray &f)
friend bool operator!=(FlagArray left, FlagArray right)
BitField set_
Values of the mask. Only bits given by mask_ are significant.
IntFormatSpec< int, TypeSpec<'x'> > hex(int value)
std::bitset with generalized mask mechanism.
BitField flags_
flags storage
static constexpr Mask none_mask
FlagArray & add(Mask mask)
unsigned int BitField
Declaration of internal bitfield type.
constexpr Mask operator&(Mask other) const
static const unsigned int size
Allocated size of flags storage.
constexpr bool match(Mask mask) const
constexpr bool match(BitField flags) const
friend constexpr bool operator==(FlagArray left, FlagArray right)
constexpr Mask operator~() const
Mask negation.
constexpr Mask(BitField mask, BitField set)
Constructor.
friend std::ostream & operator<<(std::ostream &stream, const Mask &m)
static constexpr Mask all_true_mask
static constexpr Mask all_false_mask
FlagArray()
Default constructor turns all flags off.
constexpr Mask(BitField mask)
FlagArray(Mask mask)
Conversion from the mask.
static constexpr BitField mask_set(BitField set1, BitField mask2, BitField set2)
Returns bitset set1 with bits given by mask set to the values given by the bitset set2...