FRAMES NO FRAMES

Class IlcFloatExpIterator

Definition file: ilsolver/fltexp.h
Include file: <ilsolver/ilosolver.h>

An instance of the class IlcFloatExpIterator is an iterator that traverses the values belonging to the domain of a constrained discrete floating-point expression. A discrete floating-point variable is an instance of IlcFloatVar defined by this constructor:

IlcFloatVar

In other words, it is a floating-point variable with an enumerated domain.

An iterator of this class will not traverse the domain of a continuous floating-point variable (that is, one created by the other constructors of IlcFloatVar) because its domain is represented by an interval (not an enumerated set).

For more information, see the concept Iterator.

See Also:

Constructor and Destructor Summary
public IlcFloatExpIterator(IlcFloatExp exp)
Method Summary
public IlcBoolok() const
public IlcFloatoperator*() const
public IlcFloatExpIterator &operator++()
Constructor and Destructor Detail

IlcFloatExpIterator

public IlcFloatExpIterator(IlcFloatExp exp)

This constructor creates an iterator associated with exp to traverse the values belonging to the domain of exp. exp must be a discrete floating-point expression.


Method Detail

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 discrete floating-point expression, use the following code:

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

operator*

public IlcFloat operator*() const

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


operator++

public IlcFloatExpIterator & operator++()

This operator advances the iterator to point to the next value in the domain of the constrained discrete floating-point expression.