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