![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Typesafe bitmask wrapper for enum flags. More...
#include <dfx-utilities/Flags.hpp>
Public Types | |
| using | enum_type = Enum |
| The wrapped enum type. | |
| using | value_type = std::underlying_type_t<Enum> |
| The underlying integer storage type. | |
Public Member Functions | |
| constexpr | Flags () noexcept=default |
| Construct an empty flag set (value = 0). | |
| constexpr | explicit (false) Flags(enum_type e) noexcept |
| Construct from a single enum flag. | |
| constexpr | Flags (value_type val) noexcept |
| Construct from an underlying value. | |
Typesafe bitmask wrapper for enum flags.
Flags<Enum> wraps an enum whose enumerators represent bit flags (typically powers of two), and provides common bitmask operations (|, &, ^, ~), as well as helpers to set/test flags.
The internal storage is the enum underlying type (std::underlying_type_t<Enum>).
| using dfx::Utils::Flags< Enum >::enum_type = Enum |
The wrapped enum type.
| using dfx::Utils::Flags< Enum >::value_type = std::underlying_type_t<Enum> |
The underlying integer storage type.
|
constexprdefaultnoexcept |
Construct an empty flag set (value = 0).
|
inlineexplicitconstexprnoexcept |
Construct from an underlying value.
This constructor allows creating a flag set directly from an integral value. It is primarily intended for cases where flags have been serialized or manipulated as integers and need to be re-wrapped.
val represents a valid combination of flags for the enum_type. Passing arbitrary integers that do not map to valid bitmasks may result in undefined logical behavior during later flag testing.| val | The raw integral value to be interpreted as a bitmask. |
|
inlineconstexprnoexcept |
Construct from a single enum flag.
| e | Flag to set. |