ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
TBitSet< TInterface, TEnd, TBegin >::Reference< TBitSetCM > Class Template Reference

Description:

template<typename TInterface, TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM>
class alib::lang::TBitSet< TInterface, TEnd, TBegin >::Reference< TBitSetCM >

A publicly-accessible nested class, used as a proxy object to allow users to interact with individual bits of a bitset. The primary use of this type is to provide an lvalue that can be returned from operator[].

Template Parameters
TBitSetCMA constant or mutable TBitSet.

Definition at line 164 of file bitset.hpp.

#include <bitset.hpp>

Public Method Index:

constexpr Reference (const Reference &) noexcept=default
 Defaulted copy constructor.
 
constexpr Reference (TBitSetCM &set, TInterface b) noexcept
 
 ~Reference () noexcept
 Destructor. (Is declared constexpr with C++23.)
 
constexpr TInterface Bit () const noexcept
 
constexpr ReferenceFlip () noexcept
 
constexpr operator bool () noexcept
 
constexpr Referenceoperator= (bool val) noexcept
 
Referenceoperator= (const Reference &other) noexcept=default
 
constexpr bool operator== (const Reference &rhs) const noexcept=default
 
constexpr bool operator~ () noexcept
 
constexpr const class TBitSetTBitSet () const noexcept
 
constexpr class TBitSetTBitSet () noexcept
 

Field Details:

◆ bit

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
TInterface bit
protected

The bit number in bitSet this reference addresses.

Definition at line 171 of file bitset.hpp.

◆ bitSet

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
TBitSetCM* bitSet
protected

The TBitSet this reference addresses.

Definition at line 172 of file bitset.hpp.

Constructor(s) / Destructor Details::

◆ Reference()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr Reference ( TBitSetCM & set,
TInterface b )
inlineconstexprnoexcept

Constructor.

Note
In contrast to the constructor of std::bitset::reference, this constructor is public to allow easy external construction.
Parameters
setThe parent TBitSet.
bThe bit to represent in the TBitSet.

Definition at line 180 of file bitset.hpp.

◆ ~Reference()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
~Reference ( )
inlinenoexcept

Destructor. (Is declared constexpr with C++23.)

Definition at line 188 of file bitset.hpp.

Method Details:

◆ Bit()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr TInterface Bit ( ) const
inlineconstexprnoexcept

Returns the represented bit number.

Returns
The bit that this object refers to.

Definition at line 198 of file bitset.hpp.

◆ Flip()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr Reference & Flip ( )
inlineconstexprnoexcept

Flips the represented bit.

Returns
A reference to this.

Definition at line 229 of file bitset.hpp.

Here is the call graph for this function:

◆ operator bool()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr operator bool ( )
inlineconstexprnoexcept

Implicit conversion to bool.

Returns
The value of the represented bit.

Definition at line 219 of file bitset.hpp.

◆ operator=() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr Reference & operator= ( bool val)
inlineconstexprnoexcept

Sets or resets the represented bit.

Parameters
valThe value to assign to the represented bit.
Returns
A reference to this.

Definition at line 214 of file bitset.hpp.

◆ operator=() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
Reference & operator= ( const Reference< TBitSetCM > & other)
defaultnoexcept

Copy assignment operator. (Defaulted, as otherwise implicitly deleted due to user-provided destructor.)

Parameters
otherThe object to copy.
Returns
A reference to this.

◆ operator==()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr bool operator== ( const Reference< TBitSetCM > & rhs) const
constexprdefaultnoexcept

Compares this object to another.

Parameters
rhsThe right hand side of the comparisson.
Returns
true if the objects reference the same bit in the same bitset, false otherwise

◆ operator~()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr bool operator~ ( )
inlineconstexprnoexcept

Does not manipulate the bit, but returns its negated value.

Returns
The negated value of the represented bit.

Definition at line 224 of file bitset.hpp.

◆ TBitSet() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr const class TBitSet & TBitSet ( ) const
inlineconstexprnoexcept

Returns the underlying bitset.

Returns
The TBitSet that this object refers to.

Definition at line 208 of file bitset.hpp.

◆ TBitSet() [2/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
constexpr class TBitSet & TBitSet ( )
inlineconstexprnoexcept

Returns the underlying bitset.

Returns
The TBitSet that this object refers to.

Definition at line 203 of file bitset.hpp.


The documentation for this class was generated from the following file: