Share via


CSimpleArray::operator

Retrieves an element from the array.

T& operator[]( 
   int nIndex  
);

Parameters

  • nIndex
    The element index.

Return Value

Returns the element of the array referenced by nIndex.

Example

// Create an array and display its contents
 CSimpleArray<int> iMySampleArray;

 for (int i = 0; i < 10; i++)
    iMySampleArray.Add(i);

 for (int i = 0; i < iMySampleArray.GetSize(); i++)
    _tprintf_s(_T("Array index %d contains %d\n"), i, iMySampleArray[i]);

Requirements

Header: atlsimpcoll.h

See Also

Reference

CSimpleArray Class