CVector::SetSize

void SetSize( int nDim=1, double nValue=0 );
throw( CMemoryException );

Parameters

nDim

The new vector size (number of elements). Must be greater than or equal to 0.

nValue

The default value for the extended elements if a size increase is necessary.

Remarks

Establishes the size of an empty or existing array; allocates memory if necessary.

If the new size is smaller than the old size, then the vector is truncated and all unused memory is released.

Use this function to set the size of your vector before you begin using the vector. If you do not use SetSize, adding elements to your array causes it to be frequently reallocated and copied. Frequent reallocation and copying are inefficient and can fragment memory.

CVector OverviewClass Members

See Also   CVector::GetSize