|
constexpr | LBitset (Flag flags=0) noexcept |
| Constructor for LBitset.
|
|
constexpr void | add (Flag flags) noexcept |
| Add new flags to the bitfield.
|
|
constexpr void | remove (Flag flags) noexcept |
| Remove flags from the bitfield.
|
|
constexpr bool | check (Flag flags) const noexcept |
| Check if at least one flag exists.
|
|
constexpr bool | checkAll (Flag flags) const noexcept |
| Check if all specified flags exist.
|
|
constexpr Flag | get () const noexcept |
| Gets the current set of flags.
|
|
constexpr void | set (Flag flags) noexcept |
| Set new flags in the bitfield.
|
|
constexpr void | setFlag (Flag flag, bool enable) noexcept |
| Set or unset a specific flag in the bitfield.
|
|
constexpr LBitset< T > & | operator|= (T flags) noexcept |
| Performs a bitwise OR operation with another LBitset.
|
|
constexpr LBitset< T > & | operator&= (T flags) noexcept |
| Performs a bitwise AND operation with another LBitset.
|
|
constexpr LBitset< T > & | operator^= (T flags) noexcept |
| Performs a bitwise XOR operation with another LBitset.
|
|
template<class T>
class Louvre::LBitset< T >
Compact way of storing and managing conditions or states.
The LBitset class template is similar to std::bitset
in that it enables the compact storage of a set of conditions or states using bits.
Unlike std::bitset
, LBitset functions are designed to modify and retrieve bit states using flags rather than indices, which are ideally defined within an enum.
It is widely used in the private API of Louvre classes to optimize memory usage.
Example usage:
enum MyFlags
{
FlagA = 1 << 0,
FlagB = 1 << 1,
FlagC = 1 << 2
};
myFlags.
add(MyFlags::FlagA | MyFlags::FlagC);
if (myFlags.
check(MyFlags::FlagC))
{
}
Compact way of storing and managing conditions or states.
Definition LBitset.h:39
constexpr void add(Flag flags) noexcept
Add new flags to the bitfield.
Definition LBitset.h:61
constexpr bool check(Flag flags) const noexcept
Check if at least one flag exists.
Definition LBitset.h:86