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::Add

 

Call this method to add an element to the array object.


      size_t Add(
   INARGTYPE element 
);
size_t Add( );

element

The element to be added to the array.

Returns the index of the added element.

The new element is added to the end of the array. If no element is provided, an empty element is added; that is, the array is increased in size as though a real element has been added. If the operation fails, AtlThrow is called with the argument E_OUTOFMEMORY.

Example

// Declare an array of integers
CAtlArray<int> iArray;

iArray.Add(1);   // element 0
iArray.Add(2);   // element 1
iArray.Add();    // element 2

ATLASSERT(iArray.GetCount() == 3);   

Requirements

Header: atlcoll.h

Show: