bn::bitset_ref class
#include <bn_bitset.h>

ibitset implementation which manages an external elements array.

Base classes

class ibitset
Base class of bn::bitset.

Constructors, destructors, conversion operators

template<int ElementSize>
bitset_ref(element_t(&elements_array_ref)[ElementSize]) constexpr
Default constructor.
bitset_ref(span<element_t> elements_ref) constexpr
Default constructor.

Public functions

auto operator=(const ibitset& other) -> bitset_ref& constexpr
Copy assignment operator.
auto set() -> bitset_ref& constexpr
Sets all bits to true.
auto set(int index) -> bitset_ref& constexpr
Sets the specified bit to true.
auto set(int index, bool value) -> bitset_ref& constexpr
Sets the specified bit to the specified value.
auto reset() -> bitset_ref& constexpr
Sets all bits to false.
auto reset(int index) -> bitset_ref& constexpr
Sets the specified bit to false.
auto flip() -> bitset_ref& constexpr
Flips all values (changes true values to false and vice versa).
auto flip(int index) -> bitset_ref& constexpr
Flips the specified bit value (changes true value to false and vice versa).
auto operator&=(const ibitset& other) -> bitset_ref& constexpr
Sets the bits to the result of binary AND of this ibitset and the given one.
auto operator|=(const ibitset& other) -> bitset_ref& constexpr
Sets the bits to the result of binary OR of this ibitset and the given one.
auto operator^=(const ibitset& other) -> bitset_ref& constexpr
Sets the bits to the result of binary XOR of this ibitset and the given one.

Function documentation

template<int ElementSize>
bn::bitset_ref::bitset_ref(element_t(&elements_array_ref)[ElementSize]) constexpr

Default constructor.

Parameters
elements_array_ref Elements array reference.

The elements are not copied but referenced, so they should outlive the bitset_ref to avoid dangling references.

bn::bitset_ref::bitset_ref(span<element_t> elements_ref) constexpr

Default constructor.

Parameters
elements_ref Elements reference.

The elements are not copied but referenced, so they should outlive the bitset_ref to avoid dangling references.

bitset_ref& bn::bitset_ref::operator=(const ibitset& other) constexpr

Copy assignment operator.

Parameters
other ibitset to copy.
Returns Reference to this.

bitset_ref& bn::bitset_ref::set() constexpr

Sets all bits to true.

Returns Reference to this.

bitset_ref& bn::bitset_ref::set(int index) constexpr

Sets the specified bit to true.

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

bitset_ref& bn::bitset_ref::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.

bitset_ref& bn::bitset_ref::reset() constexpr

Sets all bits to false.

Returns Reference to this.

bitset_ref& bn::bitset_ref::reset(int index) constexpr

Sets the specified bit to false.

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

bitset_ref& bn::bitset_ref::flip() constexpr

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

Returns Reference to this.

bitset_ref& bn::bitset_ref::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.

bitset_ref& bn::bitset_ref::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.

bitset_ref& bn::bitset_ref::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.

bitset_ref& bn::bitset_ref::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.