Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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.

Example

See the example for CAtlArray::GetData.

Requirements

Header: atlcoll.h

Show: