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

 

Call this method to insert one array into another.


      void InsertArrayAt(
   size_t iStart,
   const CAtlArray< E, ETraits >* paNew 
);

iStart

The index at which the array is to be inserted.

paNew

The array to be inserted.

Elements from the array paNew are copied into the array object, beginning at element iStart. The existing array elements are moved to avoid being overwritten.

In debug builds, an ATLASSERT will be raised if the CAtlArray object is not valid, or if the paNew pointer is NULL or invalid.

System_CAPS_noteNote

CAtlArray::InsertArrayAt does not support arrays consisting of elements created with the CAutoPtr class.

Example

// Define two integer arrays
CAtlArray<int> iTargetArray, iSourceArray;

// Add elements to first array
for (int x = 0; x < 10; x++)
{
   iTargetArray.Add(x);
}

// Add elements to the second array
for (int x = 0; x < 10; x++)
{
   iSourceArray.Add(x * 10);
}

// Insert the Source array into the Target
// array, starting at the 5th element.
iTargetArray.InsertArrayAt(5, &iSourceArray);   

Requirements

Header: atlcoll.h

Show: