ibitset class
#include <bn_bitset.h>
Base class of bn::
Can be used as a reference type for all bn::
Derived classes
-
template<int Size>class bitset
std::bitsetlike container.- class bitset_ref
- ibitset implementation which manages an external elements array.
Public types
Public functions
- auto operator=(const ibitset& other) -> ibitset& constexpr
- Copy assignment operator.
-
auto data() const -> const element_
t* constexpr - Returns a const pointer to the beginning of the internal data.
- auto size() const -> int constexpr
- Returns the bits count.
- auto elements_size() const -> int constexpr
- Returns the elements count.
- auto count() const -> int constexpr
- Returns the number of bits that are set to
true. - auto test(int index) const -> bool constexpr
- Returns the value stored at the specified index.
- auto set() -> ibitset& constexpr
- Sets all bits to
true. - auto set(int index) -> ibitset& constexpr
- Sets the specified bit to
true. - auto set(int index, bool value) -> ibitset& constexpr
- Sets the specified bit to the specified value.
- auto reset() -> ibitset& constexpr
- Sets all bits to
false. - auto reset(int index) -> ibitset& constexpr
- Sets the specified bit to
false. - auto flip() -> ibitset& constexpr
- Flips all values (changes
truevalues tofalseand vice versa). - auto flip(int index) -> ibitset& constexpr
- Flips the specified bit value (changes
truevalue tofalseand vice versa). - auto operator[](int index) const -> bool constexpr
- Returns the value stored at the specified index.
- auto operator[](int index) -> reference constexpr
- Returns a reference to the value stored at the specified index.
- auto at(int index) const -> bool constexpr
- Returns the value stored at the specified index.
- auto at(int index) -> reference constexpr
- Returns a reference to the value stored at the specified index.
- auto all() const -> bool constexpr
- Indicates if all values are
true. - auto any() const -> bool constexpr
- Indicates if any value is
true. - auto none() const -> bool constexpr
- Indicates if all values are
false. - auto operator&=(const ibitset& other) -> ibitset& constexpr
- Sets the bits to the result of binary AND of this ibitset and the given one.
- auto operator|=(const ibitset& other) -> ibitset& constexpr
- Sets the bits to the result of binary OR of this ibitset and the given one.
- auto operator^=(const ibitset& other) -> ibitset& constexpr
- Sets the bits to the result of binary XOR of this ibitset and the given one.
- void swap(ibitset& other) constexpr
- Exchanges the contents of this ibitset with those of the other one.
Friends
Function documentation
ibitset& bn:: ibitset:: 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. |
ibitset& bn:: ibitset:: 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. |
ibitset& bn:: ibitset:: 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. |
bool operator==(const ibitset& a, const ibitset& b) constexpr
Equal operator.
| Parameters | |
|---|---|
| a | First ibitset to compare. |
| b | Second ibitset to compare. |
| Returns | true if the first ibitset is equal to the second one, otherwise false. |