Compartir a través de


CArray::SetAtGrow

Sets the array element at the specified index.

void SetAtGrow( 
   INT_PTR nIndex, 
   ARG_TYPE newElement  
);

Parameters

  • nIndex
    An integer index that is greater than or equal to 0.

  • ARG_TYPE
    Template parameter specifying the type of elements in the array.

  • newElement
    The element to be added to this array. A NULL value is allowed.

Remarks

The array grows automatically if necessary (that is, the upper bound is adjusted to accommodate the new element).

Example

// example for CArray::SetAtGrow
CArray<CPoint,CPoint> ptArray;

ptArray.Add(CPoint(10,20));   // Element 0
ptArray.Add(CPoint(30,40));   // Element 1 
// Element 2 deliberately skipped
ptArray.SetAtGrow(3, CPoint(50,60));   // Element 3     

Requirements

Header: afxtempl.h

See Also

Reference

CArray Class

Hierarchy Chart

CArray::GetAt

CArray::SetAt

CArray::ElementAt

CArray::operator []