CList::GetAt

Gets the list element at a given position.

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

Parameters

  • TYPE
    Template parameter specifying the type of object in the list.

  • position
    The position in the list of the element to get.

Return Value

See the return value description for GetHead.

Remarks

GetAt returns the element (or a reference to the element) associated with a given position. It is not the same as an index, and you cannot operate on a POSITION value yourself. A variable of type POSITION is a key for the list.

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.

Example

See the example for CList::GetHeadPosition.

Requirements

Header: afxtempl.h

See Also

Reference

CList Class

Hierarchy Chart

CList::Find

CList::SetAt

CList::GetNext

CList::GetPrev

CList::GetHead