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.



Call this method to remove one or more elements from the array.

      void RemoveAt(
   size_t iElement,
   size_t nCount = 1 


The index of the first element to remove.


The number of elements to remove.

Removes one or more elements from the array. Any remaining elements are shifted down. The upper bound is decremented, but memory is not freed until a call to CAtlArray::FreeExtra is made.

In debug builds, an ATLASSERT will be raised if the CAtlArray object is not valid, or if the combined total of iElement and nCount exceeds the total number of elements in the array. In retail builds, invalid parameters may cause unpredictable results.


// Declare an array of chars
CAtlArray<char> cMyArray;

// Add ten elements to the array
for (int a = 0; a < 10; a++)

// Remove five elements starting with
// the element at position 1
cMyArray.RemoveAt(1, 5);

// Free memory

// Confirm size of array
ATLASSERT(cMyArray.GetCount() == 5);   


Header: atlcoll.h