template<size_t kBits>
class pw::BitSet< kBits >
A constexpr-friendly fixed-size sequence of bits, similar to std::bitset.
This container allows for compile-time manipulation of a fixed number of bits. It supports common bitwise operations and is optimized for size by using the smallest possible underlying integer type.
- Template Parameters
-
| kBits | The number of bits in the set (must be <= 64). |
|
|
constexpr | BitSet (const BitSet &)=default |
| |
|
constexpr BitSet & | operator= (const BitSet &)=default |
| |
|
template<size_t kOtherBits, typename = std::enable_if_t<kBits >= kOtherBits> |
| constexpr | BitSet (const BitSet< kOtherBits > &other) |
| |
|
template<size_t kOtherBits, typename = std::enable_if_t<kBits >= kOtherBits> |
| constexpr BitSet & | operator= (const BitSet &other) |
| |
|
constexpr bool | operator== (const BitSet &other) const |
| |
|
constexpr bool | operator!= (const BitSet &other) const |
| |
|
template<size_t kBit> |
| constexpr bool | test () const |
| |
|
constexpr bool | all () const |
| |
|
constexpr bool | any () const |
| |
|
constexpr bool | none () const |
| |
|
constexpr size_t | count () const |
| |
|
constexpr size_t | size () const |
| |
|
constexpr BitSet & | set () |
| |
|
template<size_t... kBitsToSet> |
| constexpr BitSet & | set () |
| |
|
constexpr BitSet & | reset () |
| |
|
template<size_t... kBitsToReset> |
| constexpr BitSet & | reset () |
| |
|
constexpr BitSet & | flip () |
| |
|
template<size_t... kBitsToFlip> |
| constexpr BitSet & | flip () |
| |
|
constexpr BitSet & | operator&= (const BitSet &other) |
| |
|
constexpr BitSet & | operator|= (const BitSet &other) |
| |
|
constexpr BitSet & | operator^= (const BitSet &other) |
| |
|
constexpr BitSet & | operator<<= (size_t pos) |
| |
|
constexpr BitSet & | operator>>= (size_t pos) |
| |
|
constexpr BitSet | operator~ () const |
| |
|
constexpr value_type | to_integer () const |
| | Returns the bit set as an integer.
|
| |