Share via


CTypedPtrList::GetAt

A variable of type POSITION is a key for the list.

TYPE& GetAt( 
   POSITION position  
); 
TYPE GetAt( 
   POSITION position  
) const;

Parameters

  • TYPE
    Template parameter specifying the type of elements stored in the list.

  • position
    A POSITION value returned by a previous GetHeadPosition or Find member function call.

Return Value

If the list is accessed through a pointer to a const CTypedPtrList, then GetAt returns a pointer of the type specified by the template parameter TYPE. This allows the function to be used only on the right side of an assignment statement and thus protects the list from modification.

If the list is accessed directly or through a pointer to a CTypedPtrList, then GetAt returns a reference to a pointer of the type specified by the template parameter TYPE. This allows the function to be used on either side of an assignment statement and thus allows the list entries to be modified.

Remarks

It is not the same as an index, and you cannot operate on a POSITION value yourself. GetAt retrieves the CObject pointer associated with a given position.

You must ensure that your POSITION value represents a valid position in the list. If it is invalid, then the Debug version of the Microsoft Foundation Class Library asserts.

This inline function calls BASE_CLASS**::GetAt**.

Requirements

Header: afxtempl.h

See Also

Reference

CTypedPtrList Class

Hierarchy Chart

CObList::GetAt