Dune::Copasi
|
Bit flags for enumerators. More...
#include <bit_flags.hh>
Public Member Functions | |
constexpr | BitFlags () |
Default constructor. | |
constexpr | BitFlags (const Enum &value) |
Enum constructor. | |
BitFlags (const BitSet &bit_set) | |
Bit set constructor. | |
constexpr BitSet | as_bitset () const |
Return bitflag as bitset. | |
constexpr UnderlyingType | as_underlying () const |
Return bitflag as its underlying type. | |
constexpr UnderlyingType & | as_underlying () |
Return bitflag as its underlying type. | |
constexpr Enum | as_enum () const |
Return bitflag as its underlying enum. | |
constexpr Enum & | as_enum () |
Return bitflag as its underlying enum. | |
constexpr | operator Enum () const |
Implicit conversion to underlying enum. | |
constexpr BitFlags | operator| (const BitFlags &rhs) const |
Bitwise or operator with another bitflag. | |
constexpr BitFlags | operator& (const BitFlags &rhs) const |
Bitwise and operator with another bitflag. | |
constexpr BitFlags | operator^ (const BitFlags &rhs) const |
Bitwise xor operator with another bitflag. | |
constexpr BitFlags | operator<< (std::size_t pos) const |
Bitwise left shift operator. | |
constexpr BitFlags | operator>> (std::size_t pos) const |
Bitwise right shift operator. | |
BitFlags & | operator|= (const BitFlags &rhs) |
Bitwise or operator with this bitflag. | |
BitFlags & | operator&= (const BitFlags &rhs) |
Bitwise and operator with this bitflag. | |
BitFlags & | operator^= (const BitFlags &rhs) |
Bitwise xor operator with this bitflag. | |
BitFlags & | operator<<= (std::size_t pos) |
Bitwise left shift operator with this bitflag. | |
BitFlags & | operator>>= (std::size_t pos) |
Bitwise right shift operator with this bitflag. | |
constexpr BitFlags | operator~ () const |
Bitwise not operator of this bitflag. | |
constexpr bool | test (const BitFlags &flag) const |
Test if the required flag is active in the bitflag. | |
void | reset (const BitFlags &flag) |
Reset the required flags in the bitflag. | |
void | set (const BitFlags &flag, bool value=true) |
Set the required flags to true. | |
void | flip (const BitFlags &flag) |
Flip the required flags. | |
constexpr bool | all () const |
Checks if all flags are set to true. | |
constexpr bool | any () const |
Checks if any flags are set to true. | |
constexpr bool | none () const |
Checks if none flags are set to true. | |
Static Public Member Functions | |
static constexpr BitFlags< Enum > | all_flags () |
Bitflag with all flags turned on. | |
static constexpr BitFlags< Enum > | no_flags () |
Bitflag with all flags turned off. | |
Bit flags for enumerators.
This class allows that an enum can be operated as a bit set of flags. When an enum is a bit flags (see is_bitflags) most operators expected for bits are enabled to operate directly on that enum. This object is different than a std::bitset because it is fully constexpr and because operators on the underlying enum are automatic.
Enum | Enumerator to be converted into a bit flag |
|
inlineconstexpr |
Default constructor.
|
inlineconstexpr |
Enum constructor.
|
inlineexplicit |
Bit set constructor.
|
inlineconstexpr |
Checks if all flags are set to true.
|
inlinestaticconstexpr |
Bitflag with all flags turned on.
|
inlineconstexpr |
Checks if any flags are set to true.
|
inlineconstexpr |
Return bitflag as bitset.
|
inlineconstexpr |
Return bitflag as its underlying enum.
|
inlineconstexpr |
Return bitflag as its underlying enum.
|
inlineconstexpr |
Return bitflag as its underlying type.
|
inlineconstexpr |
Return bitflag as its underlying type.
Flip the required flags.
|
inlinestaticconstexpr |
Bitflag with all flags turned off.
|
inlineconstexpr |
Checks if none flags are set to true.
|
inlineexplicitconstexpr |
Implicit conversion to underlying enum.
|
inlineconstexpr |
Bitwise and operator with another bitflag.
|
inline |
Bitwise and operator with this bitflag.
|
inlineconstexpr |
Bitwise left shift operator.
|
inline |
Bitwise left shift operator with this bitflag.
|
inlineconstexpr |
Bitwise right shift operator.
|
inline |
Bitwise right shift operator with this bitflag.
|
inlineconstexpr |
Bitwise xor operator with another bitflag.
|
inline |
Bitwise xor operator with this bitflag.
|
inlineconstexpr |
Bitwise or operator with another bitflag.
|
inline |
Bitwise or operator with this bitflag.
|
inlineconstexpr |
Bitwise not operator of this bitflag.
Reset the required flags in the bitflag.
|
inline |
Set the required flags to true.
|
inlineconstexpr |
Test if the required flag is active in the bitflag.