#include <bn_bitset.h>
template<int Size>
bn::bitset class

bitset implementation.

Template parameters
Size Number of bits stored.

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

bitset() constexpr
Default constructor.
bitset(const bitset& other) constexpr
Copy constructor.

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 true values to false and vice versa).
auto flip(int index) -> bitset& constexpr
Flips the specified bit value (changes true value to false and 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>
bn::bitset<Size>::bitset(const bitset& other) constexpr

Copy constructor.

Parameters
other bitset to copy.

template<int Size>
bitset& bn::bitset<Size>::operator=(const bitset& other) constexpr

Copy assignment operator.

Parameters
other bitset to copy.
Returns Reference to this.

template<int Size>
bitset& bn::bitset<Size>::set() constexpr

Sets all bits to true.

Returns Reference to this.

template<int Size>
bitset& bn::bitset<Size>::set(int index) constexpr

Sets the specified bit to true.

Parameters
index Index of the bit to set.
Returns Reference to this.

template<int Size>
bitset& bn::bitset<Size>::set(int index, bool value) constexpr

Sets the specified bit to the specified value.

Parameters
index Index of the bit to set.
value Value to set.
Returns Reference to this.

template<int Size>
bitset& bn::bitset<Size>::reset() constexpr

Sets all bits to false.

Returns Reference to this.

template<int Size>
bitset& bn::bitset<Size>::reset(int index) constexpr

Sets the specified bit to false.

Parameters
index Index of the bit to set.
Returns Reference to this.

template<int Size>
bitset& bn::bitset<Size>::flip() constexpr

Flips all values (changes true values to false and vice versa).

Returns Reference to this.

template<int Size>
bitset& bn::bitset<Size>::flip(int index) constexpr

Flips the specified bit value (changes true value to false and vice versa).

Parameters
index Index of the bit to flip.
Returns Reference to this.

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.