Skip to main content
FRAMES NO FRAMES

Class IloIntArray

Definition file: ilconcert/iloenv.h
Map of IloIntArrayIloIntArrayIloBoolArrayIloIntArray
The array class of the basic integer class.

IloIntArray is the array class of the basic integer class for a model. It is a handle class. The implementation class for IloIntArray is the undocumented class IloIntArrayI.

Instances of IloIntArray are extensible. (They differ from instances of IlcIntArray in this respect.) References to an array change whenever an element is added to or removed from the array.

For each basic type, Concert Technology defines a corresponding array class. That array class is a handle class. In other words, an object of that class contains a pointer to another object allocated in a Concert Technology environment associated with a model. 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.

As handles, these objects should be passed by value, and they should be created as automatic objects, where “automatic” has the usual C++ meaning.

Member functions of a handle class correspond to member functions of the same name in the implementation class.

Assert and NDEBUG

Most member functions of the class IloIntArray are inline functions that contain an assert statement. This statement checks that the handle pointer is not null. These statements can be suppressed by the macro NDEBUG. This option usually reduces execution time. The price you pay for this choice is that attempts to access through null pointers are not trapped and usually result in memory faults.

IloIntArray inherits additional methods from the template IloArray:

See Also:

Method Summary
public IloBoolcontains(IloIntArray ax) const
public IloBoolcontains(IloInt value) const
public voiddiscard(IloIntArray ax)
public voiddiscard(IloInt value)
public IloIntArray(IloArrayI * i=0)
public IloIntArray(const IloEnv env, IloInt n=0)
public IloIntArray(const IloEnv env, IloInt n, IloInt v0, IloInt v1...)
public IloIntExprArgoperator[](IloIntExprArg intExp) const
public IloInt &operator[](IloInt i)
public const IloInt &operator[](IloInt i) const
public IloNumArraytoNumArray() const
Method Detail

IloIntArray

public IloIntArray(IloArrayI * i=0)

This constructor creates an array of integers from an implementation object.


IloIntArray

public IloIntArray(const IloEnv env, IloInt n=0)

This constructor creates an array of n integers for use in a model in the environment specified by env. By default, its elements are empty handles.


IloIntArray

public IloIntArray(const IloEnv env, IloInt n, IloInt v0, IloInt v1...)

This constructor creates an array of n integers; the elements of the new array take the corresponding values: v0, v1, ..., v(n-1).


contains

public IloBool contains(IloIntArray ax) const

This member function checks whether all the values of ax are contained or not.


contains

public IloBool contains(IloInt value) const

This member function checks whether the value is contained or not.


discard

public void discard(IloIntArray ax)

This member function removes elements from the invoking array. It removes the array ax.


discard

public void discard(IloInt value)

This member function removes elements from the invoking array. It removes the element.


operator[]

public IloIntExprArg operator[](IloIntExprArg intExp) const

This subscripting operator returns an expression node for use in a constraint or expression. For clarity, let's call A the invoking array. When intExp is bound to the value i, then the domain of the expression is the domain of A[i]. More generally, the domain of the expression is the union of the domains of the expressions A[i] where the i are in the domain of intExp.

This operator is also known as an element expression.


operator[]

public IloInt & operator[](IloInt i)

This operator returns a reference to the object located in the invoking array at the position specified by the index i.


operator[]

public const IloInt & operator[](IloInt i) const

This operator returns a reference to the object located in the invoking array at the position specified by the index i. On const arrays, Concert Technology uses the const operator:

 IloArray operator[] (IloInt i) const;
 

toNumArray

public IloNumArray toNumArray() const

This constructor creates an array of integers from an array of numeric values.