Compartir a través de


CAtlArray::InsertArrayAt

Call this method to insert one array into another.

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

Parameters

  • iStart
    The index at which the array is to be inserted.

  • paNew
    The array to be inserted.

Remarks

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.

Note

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

See Also

Reference

CAtlArray Class

CAtlArray::Append