53template <Type::Un
signedEnum E>
55 return static_cast<E
>(Type::ToUnderlying(a) | Type::ToUnderlying(b));
65template <Type::Un
signedEnum E>
67 return static_cast<E
>(Type::ToUnderlying(a) & Type::ToUnderlying(b));
77template <Type::Un
signedEnum E>
79 return static_cast<E
>(Type::ToUnderlying(a) ^ Type::ToUnderlying(b));
88template <Type::Un
signedEnum E>
90 return static_cast<E
>(
~Type::ToUnderlying(a));
114 template<
typename Derived, Type::Un
signedEnum E>
164 constexpr
bool operator==(const
Bitmask& other) const noexcept;
171 constexpr
bool operator!=(const
Bitmask& other) const noexcept;
178 constexpr Derived operator|(const
Bitmask& other) const noexcept;
185 constexpr Derived operator&(const
Bitmask& other) const noexcept;
192 constexpr Derived operator^(const
Bitmask& other) const noexcept;
198 constexpr Derived operator~() const noexcept;
225 constexpr
void Add(E value) noexcept;
243 constexpr
bool Has(E value) const noexcept;
255 constexpr
bool HasAny(E value) const noexcept;
267 constexpr
bool HasNone(E value) const noexcept;
280#include <StormByte/bitmask.txx>
constexpr E operator~(E a) noexcept
Bitwise NOT for unsigned scoped enumerations.
Definition bitmask.hxx:89
constexpr E operator&(E a, E b) noexcept
Bitwise AND for unsigned scoped enumerations.
Definition bitmask.hxx:66
constexpr E operator|(E a, E b) noexcept
Bitwise OR for unsigned scoped enumerations.
Definition bitmask.hxx:54
constexpr E operator^(E a, E b) noexcept
Bitwise XOR for unsigned scoped enumerations.
Definition bitmask.hxx:78
CRTP wrapper that stores an unsigned enum as a flag set.
Definition bitmask.hxx:115
constexpr Bitmask(E value) noexcept
Mask from a single enumerator (or already combined value).
Definition bitmask.hxx:126
constexpr void Remove(E value) noexcept
Clears every bit in value.
constexpr bool HasNone(E value) const noexcept
true when no bit in value is set.
constexpr bool HasAny(E value) const noexcept
true when any bit in value is set.
constexpr bool Has(E value) const noexcept
true when every bit in value is set.
constexpr Bitmask(Bitmask &&other) noexcept=default
Move constructor.
E m_value
Packed flags.
Definition bitmask.hxx:276
constexpr E Value() const noexcept
Stored enumerators.
constexpr Bitmask() noexcept
Empty mask (static_cast<E>(0)).
Definition bitmask.hxx:120
constexpr Bitmask(const Bitmask &other) noexcept=default
Copy constructor.
virtual constexpr ~Bitmask() noexcept=default
Destructor.
constexpr void Add(E value) noexcept
Sets every bit in value.
Root namespace of the StormByte suite.
Octet count. Defined in byte_size.hxx. Forwarded so Type::Numeral can name it.