template<class T>
nCine::BitSet class

Fixed-size sequence of bits backed by an unsigned integer.

Wraps an unsigned integral type T and exposes per-bit query and manipulation methods as well as the usual bitwise and shift operators. The number of bits equals sizeof(T) * 8.

Constructors, destructors, conversion operators

BitSet()
BitSet(T value) explicit

Public functions

auto operator==(const BitSet& other) const -> bool
auto operator!=(const BitSet& other) const -> bool
auto test(std::uint32_t pos) const -> bool
Returns true if the bit at the specified position is set.
auto all() const -> bool
Returns true if all bits are set.
auto any() const -> bool
Returns true if at least one bit is set.
auto none() const -> bool
Returns true if no bit is set.
auto count() const -> std::uint32_t
Returns the number of bits that are set.
auto size() const -> std::uint32_t
Returns the total number of bits in the bitset.
auto operator&=(const BitSet& other) -> BitSet&
auto operator|=(const BitSet& other) -> BitSet&
auto operator^=(const BitSet& other) -> BitSet&
auto operator~() const -> BitSet
auto operator<<=(std::uint32_t pos) -> BitSet&
auto operator>>=(std::uint32_t pos) -> BitSet&
auto operator<<(std::uint32_t pos) const -> BitSet
auto operator>>(std::uint32_t pos) const -> BitSet
void set()
Sets all bits in the bitset.
void set(std::uint32_t pos)
Sets the bit at the specified position.
void set(std::uint32_t pos, bool value)
Sets or clears the bit at the specified position.
void reset()
Clears all bits in the bitset.
void reset(std::uint32_t pos)
Clears the bit at the specified position.
void flip(std::uint32_t pos)
Flips the bit at the specified position.
auto count() const -> std::uint32_t
auto count() const -> std::uint32_t
auto count() const -> std::uint32_t
auto count() const -> std::uint32_t

Friends

auto operator&(const BitSet& lhs, const BitSet& rhs) -> BitSet
Returns the bitwise AND of two bitsets.
auto operator|(const BitSet& lhs, const BitSet& rhs) -> BitSet
Returns the bitwise OR of two bitsets.
auto operator^(const BitSet& lhs, const BitSet& rhs) -> BitSet
Returns the bitwise XOR of two bitsets.