37 template <
class Tag,
int Size = 32>
57 constexpr
Mask() =
default;
60 constexpr
Mask(BitField mask, BitField set)
70 constexpr
Mask(BitField mask)
92 constexpr
bool match(BitField flags)
const
96 { stream << std::hex << m.
mask_ <<
", " << std::hex << m.
set_;
103 static constexpr BitField
mask_set( BitField set1, BitField mask2, BitField set2)
104 {
return (mask2 & set2) | (~mask2 & set1);
112 template <
class T,
int S>
119 static const unsigned int size = Size;
153 constexpr
bool match(Mask mask)
const
154 {
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.
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...