#include <DenseBitVector.h>
Public Member Functions | |
Iterator (const DenseBitVector &rBitVector) | |
Constructs an iterator for rBitVector. | |
virtual bool | HasMoreElements () const |
Checks if there are elements left. | |
virtual void | Begin () |
Sets the iterator on the first bit in the sps::DenseBitVector. | |
virtual void | Next () |
Sets the iterator to the next bit in the sps::DenseBitVector. | |
virtual size_t | operator * () const |
Returns the current value(bit) the iterator points to. | |
Iterator & | operator= (const Iterator &rOther) |
Overwrites this instance of Iterator with a copy of rOther . |
Example:
sps::DenseBitVector set; sps::DenseBitVector::Iterator it = set.GetIterator(); for ( it.Begin(); it.HasMoreElement(); it.Next() ) { cout << *it << ", "; }
bool sps::DenseBitVector::Iterator::HasMoreElements | ( | ) | const [inline, virtual] |
Checks if there are elements left.
If this method returns true it's save to call operator*() and Next(). The runtime of this method is in O(1).
void sps::DenseBitVector::Iterator::Begin | ( | ) | [inline, virtual] |
Sets the iterator on the first bit in the sps::DenseBitVector.
This method should be called before any other method of the Iterator is called. In the worst case the runtime of Begin() is in O(n), where n is the vector size.
void sps::DenseBitVector::Iterator::Next | ( | ) | [inline, virtual] |
Sets the iterator to the next bit in the sps::DenseBitVector.
Don't call this method if HasMoreElements() returned false. In the worst case the runtime of Begin() is in O(n), where n is the vector size.
size_t sps::DenseBitVector::Iterator::operator * | ( | ) | const [inline, virtual] |
Returns the current value(bit) the iterator points to.
Don't call this method if HasMoreElements() returned false. The runtime of operator*() is in O(1).
DenseBitVector::Iterator & sps::DenseBitVector::Iterator::operator= | ( | const Iterator & | rOther | ) | [inline] |
Overwrites this instance of Iterator with a copy of rOther
.
The runtime of this method is in O(1).