Export (0) Print
Expand All

CAtlArray::SetCount

Call this method to set the size of the array object.

bool SetCount( 
   size_t nNewSize, 
   int nGrowBy = - 1  
);

nNewSize

The required size of the array.

nGrowBy

A value used to determine how large to make the buffer. A value of -1 causes an internally calculated value to be used.

Returns true if the array is successfully resized, false otherwise.

The array can be increased or decreased in size. If increased, extra empty elements are added to the array. If decreased, the elements with the largest indices will be deleted and memory freed.

Use this method to set the size of the array before using it. If SetCount is not used, the process of adding elements — and the subsequent memory allocation performed — will reduce performance and fragment memory.

See the example for CAtlArray::GetData.

Header: atlcoll.h

Show:
© 2014 Microsoft