ILOG CPLEX 11.0 Getting Started > Tutorials > Concert Technology Tutorial for C++ Users > The Anatomy of an ILOG Concert Technology C++ Application > Constructing the Environment: IloEnv

An environment, that is, an instance of IloEnv is typically the first object created in any Concert Technology application.

You construct an IloEnv object by declaring a variable of type IloEnv. For example, to create an environment named env, you do this:

IloEnv env;

Note
The environment object created in an ILOG Concert Technology application is different from the environment created in the ILOG CPLEX C library by calling the routine CPXopenCPLEX.

The environment object is of central importance and needs to be available to the constructor of all other ILOG Concert Technology classes because (among other things) it provides optimized memory management for objects of ILOG Concert Technology classes. This provides a boost in performance compared to the memory management of the operating system.

As is the case for most ILOG Concert Technology classes, IloEnv is a handle class. This means that the variable env is a pointer to an implementation object, which is created at the same time as env in the above declaration. One advantage of using handles is that if you assign handle objects, all that is assigned is a pointer. So the statement

IloEnv env2 = env;

creates a second handle pointing to the implementation object that env already points to. Hence there may be an arbitrary number of IloEnv handle objects all pointing to the same implementation object. When terminating the ILOG Concert Technology application, the implementation object must be destroyed as well. This must be done explicitly by the user by calling

env.end();

for just ONE of the IloEnv handles pointing to the implementation object to be destroyed. The call to env.end is generally the last ILOG Concert Technology operation in an application.