ALib C++ Library
Library Version: 2412 R0
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 a lvalue that can be returned from operator[].

Template Parameters
TBitSetCMA constant or mutable TBitSet.

Definition at line 163 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
 

Protected Field Index:

TInterface bit
 The bit number in bitSet this reference addresses.
 
TBitSetCM * bitSet
 The TBitSet this reference addresses.
 

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 170 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 171 of file bitset.hpp.

Constructor(s) / Destructor Details:

◆ Reference()

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
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 179 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 187 of file bitset.hpp.

Method Details:

◆ Bit()

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

Returns the represented bit number.

Returns
The bit that this object refers to.

Definition at line 197 of file bitset.hpp.

◆ Flip()

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

Flips the represented bit.

Returns
A reference to this.

Definition at line 228 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 >
operator bool ( )
inlineconstexprnoexcept

Implicit conversion to bool.

Returns
The value of the represented bit.

Definition at line 218 of file bitset.hpp.

◆ operator=() [1/2]

template<typename TInterface , TInterface TEnd, TInterface TBegin = 0>
template<typename TBitSetCM >
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 213 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 >
bool operator== ( const Reference< TBitSetCM > & rhs) const
constexprdefaultnoexcept

Compares this object to another.

Parameters
rhsThe right hand side of the comparison.
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 >
bool operator~ ( )
inlineconstexprnoexcept

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

Returns
The negated value of the represented bit.

Definition at line 223 of file bitset.hpp.

◆ TBitSet() [1/2]

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

Returns the underlying bitset.

Returns
The TBitSet that this object refers to.

Definition at line 207 of file bitset.hpp.

◆ TBitSet() [2/2]

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

Returns the underlying bitset.

Returns
The TBitSet that this object refers to.

Definition at line 202 of file bitset.hpp.


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