Overview | Group | Tree | Graph | Index | Concepts |
IlcAnyArray
is the array class for the basic pointer class.
It is a handle class.
An object of this class contains a pointer to another object allocated on the Solver heap. Exploiting handles in this way greatly simplifies the programming interface since the handle can then be an automatic object: as a developer using handles, you do not have to worry about memory allocation.
Empty Handle or Null Array
It is possible to create a null array, or in other words, an empty handle. When you do so, only these operations are allowed on that null array:
getSize
for the null array returns 0 (zero).
ok
returns
IlcFalse
for a null array.Attempts to access a null array in any other way will throw an exception
(an instance of IloSolver::SolverErrorException
).
See Also:
IlcAnyExp, IlcAnySet, IlcConstAnyArray, operator<<
Constructor Summary | |
---|---|
public | IlcAnyArray() |
public | IlcAnyArray(IlcInt * impl) |
public | IlcAnyArray(IlcAny * impl) |
public | IlcAnyArray(IloSolver solver, IlcInt size, IlcAny * values) |
public | IlcAnyArray(IloSolver solver, IlcInt size, const IlcAny exp0, const IlcAny exp...) |
public | IlcAnyArray(IloSolver solver, IlcInt size) |
Method Summary | |
---|---|
public IlcInt * | getImpl() const |
public IlcInt | getSize() const |
public IloSolver | getSolver() const |
public void | operator=(const IlcAnyArray & h) |
public IlcAnyExp | operator[](const IlcIntExp rank) const |
public IlcAny & | operator[](IlcInt i) const |
Constructor Detail |
---|
This constructor creates an empty handle. You must initialize it before you use it.
This constructor creates a handle object from a pointer to an implementation object.
This constructor creates a handle object from a pointer to an implementation object.
This constructor creates an array of pointers containing the values in the
array values
. The argument size
must be the length of
the array values
; it must also be strictly greater than 0 (zero).
Solver does not keep a pointer to the array values
.
This constructor accepts a variable number of arguments. Its first argument,
size
, indicates the length of the array that this constructor will
create; size
must be the same as the number of instances of
IlcAny
passed as arguments; it must also be strictly greater than
0 (zero). The constructor creates an array of the values indicated by the other
arguments (the instances of IlcAny
).
This constructor creates an array of size
elements. The elements of this array are not initialized. The argument size
must be strictly greater than 0 (zero).
Method Detail |
---|
This member function returns a pointer to the implementation object of the invoking handle.
This member function returns the number of elements in the invoking array.
This member function returns an instance of IloSolver
associated with the invoking object.
This operator assigns an address to the handle pointer of the invoking object. That address is the location of the implementation object of the provided argument.
This subscripting operator returns a constrained enumerated expression. For clarity, let's call A
the invoking array. When rank
is bound to the value i
, the value of the expression is A[i]
. More generally, the domain of the expression is the set of values A[i]
where the i
are in the domain of rank
.
This operator returns a reference to the element at rank i
. This operator can be used for accessing the element or for modifying it.