#include <bn_bitset.h>
template<int Size>
bitset class
std::bitset
like container.
Template parameters | |
---|---|
Size | Number of stored bits. It must be a multiple of 8. |
It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.
Base classes
- class ibitset
- Base class of bn::
bitset.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const bitset& other) -> bitset&
- Copy assignment operator.
- auto operator=(const ibitset& other) -> bitset&
- Copy assignment operator.
- auto set() -> bitset&
- Sets all bits to
true
. - auto set(int index) -> bitset&
- Sets the specified bit to
true
. - auto set(int index, bool value) -> bitset&
- Sets the specified bit to the specified value.
- auto reset() -> bitset&
- Sets all bits to
false
. - auto reset(int index) -> bitset&
- Sets the specified bit to
false
. - auto flip() -> bitset&
- Flips all values (changes
true
values tofalse
and vice versa). - auto flip(int index) -> bitset&
- Flips the specified bit value (changes
true
value tofalse
and vice versa). - auto operator&=(const ibitset& other) -> bitset&
- Sets the bits to the result of binary AND of this ibitset and the given one.
- auto operator|=(const ibitset& other) -> bitset&
- Sets the bits to the result of binary OR of this ibitset and the given one.
- auto operator^=(const ibitset& other) -> bitset&
- Sets the bits to the result of binary XOR of this ibitset and the given one.
- auto operator~() const -> bitset
- Returns this bitset with all bits flipped (binary NOT).
Friends
- auto operator&(const bitset& a, const bitset& b) -> bitset
- Returns a bitset containing the result of binary AND of the given bitsets.
- auto operator|(const bitset& a, const bitset& b) -> bitset
- Returns a bitset containing the result of binary OR of the given bitsets.
- auto operator^(const bitset& a, const bitset& b) -> bitset
- 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)
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)
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)
Sets the bits to the result of binary XOR of this ibitset and the given one.
Parameters | |
---|---|
other | Another ibitset. |
Returns | Reference to this. |