#include <bn_bitset.h>
template<int Size>
bitset class
bitset implementation.
| Template parameters | |
|---|---|
| Size | Number of bits stored. |
Contents
Base classes
- class ibitset
- Base class of bitset.
Public static functions
-
static auto unsafe_from_elements(const element_
t& elements_ref) -> bitset constexpr - UNSAFE: returns a bitset from the given elements array.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const bitset& other) -> bitset& constexpr
- Copy assignment operator.
- auto set() -> bitset& constexpr
- Sets all bits to
true. - auto set(int index) -> bitset& constexpr
- Sets the specified bit to
true. - auto set(int index, bool value) -> bitset& constexpr
- Sets the specified bit to the specified value.
- auto reset() -> bitset& constexpr
- Sets all bits to
false. - auto reset(int index) -> bitset& constexpr
- Sets the specified bit to
false. - auto flip() -> bitset& constexpr
- Flips all values (changes
truevalues tofalseand vice versa). - auto flip(int index) -> bitset& constexpr
- Flips the specified bit value (changes
truevalue tofalseand vice versa). - auto operator&=(const ibitset& other) -> bitset& constexpr
- Sets the bits to the result of binary AND of this ibitset and the given one.
- auto operator|=(const ibitset& other) -> bitset& constexpr
- Sets the bits to the result of binary OR of this ibitset and the given one.
- auto operator^=(const ibitset& other) -> bitset& constexpr
- Sets the bits to the result of binary XOR of this ibitset and the given one.
- auto operator~() -> bitset constexpr
- Returns this bitset with all bits flipped (binary NOT).
Friends
- auto operator&(const bitset& a, const bitset& b) -> friend bitset constexpr
- Returns a bitset containing the result of binary AND of the given bitsets.
- auto operator|(const bitset& a, const bitset& b) -> friend bitset constexpr
- Returns a bitset containing the result of binary OR of the given bitsets.
- auto operator^(const bitset& a, const bitset& b) -> friend bitset constexpr
- Returns a bitset containing the result of binary XOR of the given bitsets.
Function documentation
template<int Size>
bitset& bn:: bitset<Size>:: operator&=(const ibitset& other) constexpr
Sets the bits to the result of binary AND of this ibitset and the given one.
| Parameters | |
|---|---|
| other | Another ibitset. |
| Returns | Reference to this. |
template<int Size>
bitset& bn:: bitset<Size>:: operator|=(const ibitset& other) constexpr
Sets the bits to the result of binary OR of this ibitset and the given one.
| Parameters | |
|---|---|
| other | Another ibitset. |
| Returns | Reference to this. |
template<int Size>
bitset& bn:: bitset<Size>:: operator^=(const ibitset& other) constexpr
Sets the bits to the result of binary XOR of this ibitset and the given one.
| Parameters | |
|---|---|
| other | Another ibitset. |
| Returns | Reference to this. |