A set of flags. The possible flags are defined by an enum type.
This is meant to be used with enum types that don't explicitly define the values of their members. Do not define the values as powers of two. Values must be between 0 and 63, inclusive.
DEFINITION
template <typename Flag>
requires std::is_enum_v<Flag>
class FlagSet;
constructor FlagSet
Create a FlagSet with all flags disabled.
constructor FlagSet
Create a FlagSet with the given flags enabled.
DEFINITION
template <typename...Args>
requires ((std::same_as<std::remove_cvref_t<Args>, Flag> || std::same_as<std::remove_cvref_t<Args>, FlagSet<Flag>>) && ...)
|
constexpr FlagSet |
( |
Args... args | ); |
| PARAMETER | DESCRIPTION |
args |
The flags to enable. Arguments can be of type Flag or other FlagSet.
|
| RETURNS | DESCRIPTION |
constexpr |
|
constructor FlagSet
Create a FlagSet from a raw bitmask.
DEFINITION
|
constexpr FlagSet |
( |
uint64_t flag_mask | ); |
| PARAMETER | DESCRIPTION |
flag_mask |
The bitmask of the flags to enable.
|
| RETURNS | DESCRIPTION |
constexpr |
|
method all_enabledconst
Check if all flags from another FlagSet are enabled.
DEFINITION
|
bool all_enabled |
( |
const FlagSet & other | ) const; |
| PARAMETER | DESCRIPTION |
other |
|
method any_enabledconst
Check if any flag from another FlagSet is enabled.
DEFINITION
|
bool any_enabled |
( |
const FlagSet & other | ) const; |
| PARAMETER | DESCRIPTION |
other |
|
| RETURNS | DESCRIPTION |
bool |
true if any flag is enabled, false otherwise.
|
method disable
DEFINITION
|
void disable |
( |
Flag flag | ); |
| PARAMETER | DESCRIPTION |
flag |
|
method disable
Disable all flags set in another FlagSet.
DEFINITION
|
void disable |
( |
const FlagSet & other | ); |
| PARAMETER | DESCRIPTION |
other |
The FlagSet containing the flags to disable.
|
method emptyconst
Check if no flags are enabled.
| RETURNS | DESCRIPTION |
bool |
true if no flags are enabled, false otherwise.
|
method enable
DEFINITION
|
void enable |
( |
Flag flag | ); |
| PARAMETER | DESCRIPTION |
flag |
|
method enable
Enable all flags set in another FlagSet.
DEFINITION
|
void enable |
( |
const FlagSet & other | ); |
| PARAMETER | DESCRIPTION |
other |
|
method get_maskstatic
Get the bitmask for a flag.
DEFINITION
|
static uint64_t get_mask |
( |
Flag flag | ); |
| PARAMETER | DESCRIPTION |
flag |
The flag to get the bitmask for.
|
| RETURNS | DESCRIPTION |
uint64_t |
The bitmask for the flag.
|
method is_enabledconst
Check if a flag is enabled.
DEFINITION
|
bool is_enabled |
( |
Flag flag | ) const; |
| PARAMETER | DESCRIPTION |
flag |
|
| RETURNS | DESCRIPTION |
bool |
true if the flag is enabled, false otherwise.
|
method operator boolconst
Interpret as bool: Check if any flags are enabled.
method operator==const
Compare two FlagSets for equality.
DEFINITION
|
bool operator== |
( |
const FlagSet & other | ) const; |
| PARAMETER | DESCRIPTION |
other |
The other FlagSet to compare with.
|
| RETURNS | DESCRIPTION |
bool |
true if both FlagSets have the same flags enabled, false otherwise.
|
method operator[]const
Check if a flag is enabled.
DEFINITION
|
bool operator[] |
( |
Flag flag | ) const; |
| PARAMETER | DESCRIPTION |
flag |
|
| RETURNS | DESCRIPTION |
bool |
true if the flag is enabled, false otherwise.
|