跳至主内容
框架 无框架

类IlcIntExpIterator

定义文件: ilcp/cpext.h
包含文件: <ilcp/cpextilcp/cpext.h
IlcIntExpIterator的地图IlcIntExpIteratorIlcIntExpIterator
整数表达式域的迭代器类。

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).

更多信息,请参阅迭代器概念。

另请参阅:

方法概要
public IlcIntExpIterator(IlcIntVar var)
public IlcBoolok() const
public IlcIntoperator*() const
public IlcIntExpIterator &operator++()
方法详细信息

IlcIntExpIterator

publicIlcIntExpIterator(IlcIntVar var)

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


确定

publicIlcBool ok() const

如果存在当前元素且迭代器指向该元素,则该成员函数返回 "IlcTrue。 否则,返回 "IlcFalse

要遍历属于约束整数表达式域的值,请使用以下代码:

 IlcIntval;
 forIlcIntExpIteratoriter(exp);iter.ok(); ++iter){
         val = *iter;
         // 对 val 进行处理
 }

操作符*

publicIlcInt operator*() const

此操作符返回当前元素,即调用迭代器指向的元素。


运算符++

publicIlcIntExpIterator&operator++()

该操作符将迭代器向前推进,指向受约束整数表达式域中的下一个值。