BaseBitSetIterator< COLLECTION > Class Template Reference

#include <basebitset.h>

Detailed Description

template<typename COLLECTION>
class maxon::BaseBitSetIterator< COLLECTION >

The BaseBitSetIterator allows you to iterate over only the set bits of a bit set. Internally it stores a pointer to the bit set object and an index to the last set bit. If we have reached the end or the iterator is invalid the index will be -1 to match the specification of the bit set.

For simplicity the iterator provides only an increment operator.

it++; // go to the next set bit
it = bitSet.Begin(); // iterator to the first set bit of the array, index will be -1 if invalid
value = *it; // get index of the bit referenced by the iterator
PyObject * value
Definition: abstract.h:715

You can also use the iterator implicitly in a range-based for loop to iterate over the set bits:

for (const Int bitIndex : bitSet)
{
// do something with the index
}
maxon::Int Int
Definition: ge_sys_math.h:60
Template Parameters
COLLECTIONType of the bit set.

Public Types

using CollectionType = COLLECTION
 

Public Member Functions

 BaseBitSetIterator (CollectionType &a, Int start=0)
 
 operator Bool () const
 
Int operator* () const
 
Int GetIndex () const
 
Bool operator== (const BaseBitSetIterator &b) const
 
Bool operator< (const BaseBitSetIterator &b) const
 
 MAXON_OPERATOR_COMPARISON (BaseBitSetIterator)
 
BaseBitSetIteratoroperator++ ()
 
BaseBitSetIterator operator++ (int)
 

Static Public Attributes

static const Bool isLinearIterator
 

Protected Attributes

CollectionType_data
 
Int _index
 

Member Typedef Documentation

◆ CollectionType

using CollectionType = COLLECTION

Constructor & Destructor Documentation

◆ BaseBitSetIterator()

BaseBitSetIterator ( CollectionType a,
Int  start = 0 
)
explicit

Member Function Documentation

◆ operator Bool()

operator Bool ( ) const

◆ operator*()

Int operator* ( ) const

◆ GetIndex()

Int GetIndex ( ) const

◆ operator==()

Bool operator== ( const BaseBitSetIterator< COLLECTION > &  b) const

◆ operator<()

Bool operator< ( const BaseBitSetIterator< COLLECTION > &  b) const

◆ MAXON_OPERATOR_COMPARISON()

MAXON_OPERATOR_COMPARISON ( BaseBitSetIterator< COLLECTION >  )

◆ operator++() [1/2]

BaseBitSetIterator& operator++ ( )

◆ operator++() [2/2]

BaseBitSetIterator operator++ ( int  )

Member Data Documentation

◆ isLinearIterator

const Bool isLinearIterator
static

◆ _data

CollectionType* _data
protected

◆ _index

Int _index
protected