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.

CArray::Add

 

Adds a new element to the end of an array, growing the array by 1.


      INT_PTR Add(
   ARG_TYPE newElement 
);

ARG_TYPE

Template parameter specifying the type of arguments referencing elements in this array.

newElement

The element to be added to this array.

The index of the added element.

If SetSize has been used with an nGrowBy value greater than 1, then extra memory may be allocated. However, the upper bound will increase by only 1.

Example

// example for CArray::Add
CArray<CPoint,CPoint> ptArray;

CPoint pt(10,20);
ptArray.Add(pt);             // Element 0
ptArray.Add(CPoint(30,40));  // Element 1

Requirements

Header: afxtempl.h

Show: