Overview | Group | Tree | Graph | Index | Concepts |
Solver provides iterators to traverse the values of an array of
constrained enumerated variables. Those iterators are instances of the class
IlcAnyVarArrayIterator
. An instance of that class iterates
forward over a subinterval [indexMin indexMax)
of the index
range of the array.
For more information, see the concept Iterator.
See Also:
Constructor and Destructor Summary | |
---|---|
public | IlcAnyVarArrayIterator(const IlcAnyVarArray array) |
Method Summary | |
---|---|
public IlcBool | next(IlcAnyVar & variable) |
public IlcBool | ok() const |
Constructor and Destructor Detail |
---|
This constructor creates an iterator to traverse the values belonging to the array of constrained enumerated variables. This iterator lets you iterate forward over the complete index range of the array.
Method Detail |
---|
This member function takes a reference to a constrained enumerated
variable and returns a Boolean value. It begins with the first element.
It returns IlcFalse
if there is no other element on which
to iterate and IlcTrue
otherwise. When it returns
IlcTrue
, it writes the next element of the iterator (forward
iteration) to the argument.
This member function returns IlcTrue
if there is a
current element and the invoking iterator points to it. Otherwise,
it returns IlcFalse
.
To traverse the elements of a finite set of pointers, use the following code:
IlcAny val; for(IlcAnySetIterator iter(set); iter.ok(); ++iter){ val = *iter; // do something with val }