Skip to main content
FRAMES NO FRAMES

Class IlcIntExpIterator

Definition file: ilcp/cpext.h
Include file: <ilcp/cpext.h>
Map of IlcIntExpIteratorIlcIntExpIteratorIlcIntExpIterator
The iterator class for the domains of integer expressions.

An instance of the class IlcIntExpIterator is an iterator that traverses the values belonging to the domain of a constrained integer expression (an instance of IlcIntExp or IlcIntVar).

For more information, see the concept Iterator.

See Also:

Method Summary
public IlcIntExpIterator(IlcIntVar var)
public IlcBoolok() const
public IlcIntoperator*() const
public IlcIntExpIterator &operator++()
Method Detail

IlcIntExpIterator

public IlcIntExpIterator(IlcIntVar var)

This constructor creates an iterator associated with var to traverse the values belonging to the domain of var.


ok

public IlcBool ok() const

This member function returns IlcTrue if there is a current element and the iterator points to it. Otherwise, it returns IlcFalse.

To traverse the values belonging to the domain of a constrained integer expression, use the following code:

 IlcInt val;
 for (IlcIntExpIterator iter(exp); iter.ok(); ++iter){
         val = *iter;
         // do something with val
 }

operator*

public IlcInt operator*() const

This operator returns the current element, the one to which the invoking iterator points.


operator++

public IlcIntExpIterator & operator++()

This operator advances the iterator to point to the next value in the domain of the constrained integer expression.