CArray::InsertAt

The first implementation of this method inserts one element (or multiple copies of an element) at a specified index in an array. In the process, it shifts up (by incrementing the index) the existing element at this index, and it shifts up all the elements above it.

The second implementation inserts all the elements from another CArray collection, starting at the nStartIndex position.

The SetAt method, in contrast, replaces one specified array element and does not shift any elements.

At a Glance

Header file: Afxtempl.h
Platforms: H/PC 2.0, Palm-size PC, H/PC Pro
Windows CE versions: 1.0 and later
Complete documentation: Visual C++ documentation

Syntax

void InsertAt( int nIndex, ARG_TYPE newElement, int nCount = 1 );
throw( CMemoryException );

void InsertAt( int nStartIndex, CArray* pNewArray );
throw( CMemoryException );

See Also

GetUpperBound, CArray::SetAt, CArray::RemoveAt