CArray::RemoveAt

void RemoveAt( int nIndex, int nCount = 1 );

Parameters

nIndex

An integer index that is greater than or equal to 0 and less than or equal to the value returned by GetUpperBound.

nCount

The number of elements to remove.

Remarks

Removes one or more elements starting at a specified index in an array. In the process, it shifts down all the elements above the removed element(s). It decrements the upper bound of the array but does not free memory.

If you try to remove more elements than are contained in the array above the removal point, then the Debug version of the library asserts.

Example

CArray<CPoint,CPoint> myArray;

// Add elements to the array.
for (int i=0;i < 10;i++)
   myArray.Add( CPoint(i, 2*i) );

myArray.RemoveAt(5);

#ifdef _DEBUG
    afxDump.SetDepth( 1 );
    afxDump << "myArray: " << &myArray << "\n";
#endif

CArray OverviewClass MembersHierarchy Chart

See Also   CArray::SetAt, CArray::SetAtGrow, CArray::InsertAt