33template <Type::Un
signedEnum E>
45template <Type::Un
signedEnum E>
57template <Type::Un
signedEnum E>
68template <Type::Un
signedEnum E>
70 return static_cast<E
>(~Type::ToUnderlying(a));
94 template<
typename Derived, Type::Un
signedEnum E>
144 constexpr
bool operator==(const
Bitmask& other) const noexcept;
151 constexpr
bool operator!=(const
Bitmask& other) const noexcept;
158 constexpr Derived operator|(const
Bitmask& other) const noexcept;
165 constexpr Derived operator&(const
Bitmask& other) const noexcept;
172 constexpr Derived operator^(const
Bitmask& other) const noexcept;
178 constexpr Derived operator~() const noexcept;
205 constexpr
void Add(E value) noexcept;
223 constexpr
bool Has(E value) const noexcept;
235 constexpr
bool HasAny(E value) const noexcept;
247 constexpr
bool HasNone(E value) const noexcept;
260#include <StormByte/bitmask.txx>
constexpr E operator~(E a) noexcept
Bitwise NOT for unsigned scoped enumerations.
Definition bitmask.hxx:69
constexpr E operator&(E a, E b) noexcept
Bitwise AND for unsigned scoped enumerations.
Definition bitmask.hxx:46
constexpr E operator|(E a, E b) noexcept
Bitwise OR for unsigned scoped enumerations.
Definition bitmask.hxx:34
constexpr E operator^(E a, E b) noexcept
Bitwise XOR for unsigned scoped enumerations.
Definition bitmask.hxx:58
CRTP wrapper that stores an unsigned enum as a flag set.
Definition bitmask.hxx:95
constexpr Bitmask(E value) noexcept
Mask from a single enumerator (or already combined value).
Definition bitmask.hxx:106
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:256
constexpr E Value() const noexcept
Stored enumerators.
constexpr Bitmask() noexcept
Empty mask (static_cast<E>(0)).
Definition bitmask.hxx:100
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.
constexpr UnderlyingType< E > ToUnderlying(E e) noexcept
Converts an enumeration value to its underlying integer.
Definition enums.hxx:103
Root namespace of the StormByte suite.