NO FRAMES

Class IloSolution::Iterator

Definition file: ilconcert/ilosolution.h
It allows you to traverse the variables in a solution.

Iterator is a class nested in the class IloSolution. It allows you to traverse the variables in a solution. The iterator scans the objects in the same order as they were added to the solution.

This iterator is not robust. If the variable at the current position is deleted from the solution being iterated over, the behavior of this iterator afterward is undefined.

 IloExtractable elem = *iter;

 ++iter;

 solution.remove(elem);
 
 solution.remove(*iter); // bad idea

 ++iter;
 

See Also:

Constructor Summary
public Iterator(IloSolution solution)
Method Summary
public IloBoolok() const
public IloExtractableoperator *() const
public Iterator &operator++()
Constructor Detail

Iterator

public Iterator(IloSolution solution)

This constructor creates an iterator to traverse the variables of solution. The iterator traverses variables in the same order they were added to solution.


Method Detail

ok

public IloBool ok() const

This member function returns IloTrue if the current position of the iterator is a valid one. It returns IloFalse if all variables have been scanned by the iterator.


operator *

public IloExtractable operator *() const

This operator returns the extractable object corresponding to the variable located at the current iterator position. If all variables have been scanned, this operator returns an empty handle.


operator++

public Iterator & operator++()

This operator moves the iterator to the next variable in the solution.