Поделиться через


CArray::Add

Adds a new element to the end of an array, growing the array by 1.

INT_PTR Add(
      ARG_TYPE newElement 
);

Параметры

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

  • newElement
    The element to be added to this array.

Возвращаемое значение

The index of the added element.

Заметки

If SetSize has been used with an nGrowBy value greater than 1, then extra memory may be allocated. However, the upper bound will increase by only 1.

Пример

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

CPoint pt(10,20);
ptArray.Add(pt);             // Element 0
ptArray.Add(CPoint(30,40));  // Element 1

Требования

Header: afxtempl.h

См. также

Основные понятия

CArray Class

CArray Members

Hierarchy Chart

CArray::SetAt

CArray::SetAtGrow

CArray::InsertAt

CArray::operator []