carl  24.04
Computer ARithmetic Library
carl::Bitset::iterator Struct Reference

Iterate for iterate over all bits of a Bitset that are set to true. More...

#include <Bitset.h>

Collaboration diagram for carl::Bitset::iterator:

Public Member Functions

 iterator (const Bitset &b, std::size_t bit)
 Construct a new iterator from a Bitset and a bit. More...
 
 operator std::size_t () const
 Retrieve the index into the Bitset. More...
 
std::size_t operator* () const
 Retrieve the index into the Bitset. More...
 
iteratoroperator++ ()
 Step to the next bit that is set to true. More...
 
iterator operator++ (int)
 Step to the next bit that is set to true. More...
 
bool operator== (const iterator &rhs) const
 Compare two iterators. Asserts that they are compatible. More...
 
bool operator!= (const iterator &rhs) const
 Compare two iterators. Asserts that they are compatible. More...
 
bool operator< (const iterator &rhs) const
 Compare two iterators. Asserts that they are compatible. More...
 

Private Member Functions

bool compatible (const iterator &rhs) const
 Check that two iterators speak about the same Bitset. More...
 

Private Attributes

const BitsetmBitset
 The Bitset iterated over. More...
 
std::size_t mBit
 The current bit. More...
 

Detailed Description

Iterate for iterate over all bits of a Bitset that are set to true.

If you want to iterate of all bits that are false use operator~().

Definition at line 36 of file Bitset.h.

Constructor & Destructor Documentation

◆ iterator()

carl::Bitset::iterator::iterator ( const Bitset b,
std::size_t  bit 
)
inline

Construct a new iterator from a Bitset and a bit.

Definition at line 49 of file Bitset.h.

Member Function Documentation

◆ compatible()

bool carl::Bitset::iterator::compatible ( const iterator rhs) const
inlineprivate

Check that two iterators speak about the same Bitset.

Definition at line 44 of file Bitset.h.

◆ operator std::size_t()

carl::Bitset::iterator::operator std::size_t ( ) const
inline

Retrieve the index into the Bitset.

Definition at line 52 of file Bitset.h.

◆ operator!=()

bool carl::Bitset::iterator::operator!= ( const iterator rhs) const
inline

Compare two iterators. Asserts that they are compatible.

Definition at line 76 of file Bitset.h.

◆ operator*()

std::size_t carl::Bitset::iterator::operator* ( ) const
inline

Retrieve the index into the Bitset.

Definition at line 56 of file Bitset.h.

◆ operator++() [1/2]

iterator& carl::Bitset::iterator::operator++ ( )
inline

Step to the next bit that is set to true.

Definition at line 60 of file Bitset.h.

Here is the call graph for this function:

◆ operator++() [2/2]

iterator carl::Bitset::iterator::operator++ ( int  )
inline

Step to the next bit that is set to true.

Definition at line 65 of file Bitset.h.

◆ operator<()

bool carl::Bitset::iterator::operator< ( const iterator rhs) const
inline

Compare two iterators. Asserts that they are compatible.

Definition at line 81 of file Bitset.h.

◆ operator==()

bool carl::Bitset::iterator::operator== ( const iterator rhs) const
inline

Compare two iterators. Asserts that they are compatible.

Definition at line 71 of file Bitset.h.

Field Documentation

◆ mBit

std::size_t carl::Bitset::iterator::mBit
private

The current bit.

Definition at line 41 of file Bitset.h.

◆ mBitset

const Bitset& carl::Bitset::iterator::mBitset
private

The Bitset iterated over.

Definition at line 39 of file Bitset.h.


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