Overview | Group | Tree | Graph | Index | Concepts |
IlcRevAny
is a reversible version of the basic predefined
Solver type, IlcAny
. The reversible version makes it easier to
restore a previous state. This class has a value data member corresponding
to IlcAny
. This value data member is automatically restored
when Solver backtracks.
This class is not a handle class. Objects of this class should
be used directly, that is, not through pointers to them. Do not
create instances of IlcRevAny
as automatic objects (that is, as
objects allocated on the C++ stack). Do not pass them by value.
An object of the class IlcRevAny
is automatically cast to
the basic type IlcAny
, if needed. Instances of this reversible
class can be used as data members. However, do not use them as types for
automatic variables, where “automatic” has its usual C++
meaning, as this practice would create memory-access errors. Do not
pass them as arguments.
An instance of IlcRevAny
behaves very much like an instance
of IlcAny
; the difference in their behavior has to do with
assignments. Indeed, all reversible assignments are undone when Solver
backtracks.
Unfortunately, the class IlcRevAny
is not typed. The
pointers are of type IlcAny
and thus give no indication of the
type of objects they point to. See the macro ILCREV
for a way
to define a reversible class for typed
pointers yourself.
For more information, see the concepts State and Reversibility.
See Also:
IlcRevBool, IlcRevFloat, IlcRevInt
Constructor Summary | |
---|---|
public | IlcRevAny(IloSolver s, IlcAny initValue=0) |
Method Summary | |
---|---|
public IlcAny | getValue() const |
public | operator IlcAny() const |
public void | setValue(IloSolver solver, IlcAny value) |
Constructor Detail |
---|
The constructor creates a new object, an instance of IlcRevAny
.
It is more memory-efficient than the constructor without arguments.
Method Detail |
---|
This member function accesses the value of the invoking instance of IlcRevAny
.
This operator returns the value of the instance of IlcRevAny
.
In other words, this operator automatically casts an instance of IlcRevAny
into an instance of IlcAny
.
This member function modifies the value of the invoking object by reversibly assigning
value
to it. When Solver backtracks, this reversible modification will be undone.