OMNeT++ Simulation Library
6.0.3
|
#include <carray.h>
Iterates through elements in a cArray, skipping holes (slots containing nullptr).
Usage:
Public Member Functions | |
Iterator (const cArray &a, bool atHead=true) | |
void | init (const cArray &a, bool atHead=true) |
cObject * | operator* () const |
bool | end () const |
Iterator & | operator++ () |
Iterator | operator++ (int) |
Iterator & | operator-- () |
Iterator | operator-- (int) |
Constructor. Iterator will walk on the array passed as argument. The starting object will be the first (if atHead==true) or the last (atHead==false) object in the array, not counting empty slots.
void init | ( | const cArray & | a, |
bool | atHead = true |
||
) |
Reinitializes the iterator object.
|
inline |
Returns a pointer to the current object, or nullptr if the iterator is not at a valid position.
References cArray::get().
|
inline |
Returns true if the iterator has reached either end of the array.
References cArray::size().
|
inline |
Prefix increment operator (++it). Moves the iterator to the next non-empty slot in the array. It has no effect if the iterator has reached either end of the array.
|
inline |
Postfix increment operator (it++). Moves the iterator to the next non-empty slot in the array, and returns the iterator's previous state. It has no effect if the iterator has reached either end of the array.
|
inline |
Prefix decrement operator (–it). Moves the iterator to the previous non-empty slot in the array. It has no effect if the iterator has reached either end of the array.
|
inline |
Postfix decrement operator (it–). Moves the iterator to the previous non-empty slot in the array, and returns the iterator's previous state. It has no effect if the iterator has reached either end of the array.