Class for manipulating and testing a group of enumeration-based bits. More...
#include <eagine/bitfield.hpp>
Public Types | |
using | bit_type = Bit |
The enumeration type specifying individual bit values. | |
using | value_type = std::make_unsigned_t< std::underlying_type_t< bit_type > > |
The Integral type used to store the bits. | |
Public Member Functions | |
constexpr | bitfield () noexcept=default |
Default constructor. | |
constexpr | bitfield (value_type bits) noexcept |
Explicit construction from the underlying interger type value. | |
constexpr | bitfield (bit_type _bit) noexcept |
Construction from the bit enumeration type value. | |
constexpr auto | is_empty () const noexcept |
Indicates that none of the bits are set. | |
constexpr | operator bool () const noexcept |
Indicates that some of the bits are set. More... | |
constexpr | operator value_type () const noexcept |
Explicit conversion to the underlying integer value type. More... | |
constexpr auto | bits () const noexcept -> value_type |
Returns the bits in the underlying integer value type. | |
constexpr auto | has (bit_type bit) const noexcept |
Tests if the specified bit is set. More... | |
constexpr auto | has_not (bit_type bit) const noexcept |
Tests if the specified bit is not set. More... | |
template<typename... B> | |
constexpr auto | has_all (bit_type bit, B... bits) const noexcept -> std::enable_if_t< all_are_same_v< bit_type, B... >, bool > |
Tests if all of the specified bits are set. More... | |
template<typename... B> | |
constexpr auto | has_any (bit_type bit, B... bits) const noexcept -> std::enable_if_t< all_are_same_v< bit_type, B... >, bool > |
Tests if any of the specified bits are set. More... | |
template<typename... B> | |
constexpr auto | has_none (bit_type bit, B... bits) const noexcept -> std::enable_if_t< all_are_same_v< bit_type, B... >, bool > |
Tests if none of the specified bits are set. More... | |
constexpr auto | has_only (bit_type bit) const noexcept |
Tests if only the specified bit is set. More... | |
constexpr auto | has_at_most (bit_type bit) const noexcept |
Tests if at most the specified bit is set (or is empty). More... | |
auto | operator|= (bitfield b) noexcept -> bitfield & |
Bitwise-or operator. | |
auto | operator&= (bitfield b) noexcept -> bitfield & |
Bitwise-and operator. | |
auto | clear (bit_type b) noexcept -> bitfield & |
Clears the specified bit. | |
auto | clear () noexcept -> bitfield & |
Clears all bits. More... | |
Friends | |
constexpr friend auto | operator== (bitfield a, bitfield b) noexcept |
Equality comparison. | |
constexpr friend auto | operator!= (bitfield a, bitfield b) noexcept |
Nonequality comparison. | |
constexpr friend auto | operator| (bitfield a, bitfield b) noexcept -> bitfield |
Bitwise-or operator. | |
constexpr friend auto | operator& (bitfield a, bitfield b) noexcept -> bitfield |
Bitwise-and operator. | |
constexpr friend auto | operator~ (bitfield b) noexcept -> bitfield |
Bit inversion operator. | |
Class for manipulating and testing a group of enumeration-based bits.
|
inlinenoexcept |
Clears all bits.
|
inlineconstexprnoexcept |
Tests if the specified bit is set.
Referenced by eagine::application::input_setup::has(), eagine::shapes::generator_base::is_enabled(), and eagine::msgbus::stored_message::is_signed().
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
Indicates that some of the bits are set.
|
inlineexplicitconstexprnoexcept |
Explicit conversion to the underlying integer value type.