Call this method to retrieves a single element from the array object.

      const E& GetAt(
   size_t iElement 
) const throw( );
E& GetAt(
   size_t iElement 
) throw( );


The index value of the array element to return.

Returns a reference to the required array element.

In debug builds, an ATLASSERT will be raised if iElement exceeds the number of elements in the array. In release builds, an invalid argument may lead to unpredictable behavior.


// Declare an array of integers

CAtlArray<int> iMyArray;
int element;

// Add ten elements to the array
for (int i = 0; i < 10; i++)

// Use GetAt and SetAt to modify
// every element in the array

for (size_t i = 0; i < iMyArray.GetCount(); i++)
   element = iMyArray.GetAt(i);
   element *= 10;
   iMyArray.SetAt(i, element);


Header: atlcoll.h