CAtlList::GetAt

 

Call this method to return the element at a specified position in the list.

Syntax

      E& GetAt(
   POSITION pos 
) throw( );
const E& GetAt(
   POSITION pos 
) const throw( );

Parameters

  • pos
    The POSITION value specifying a particular element.

Return Value

A reference to, or copy of, the element.

Remarks

If the list is const, GetAt returns a copy of the element. This allows the method to be used only on the right side of an assignment statement and protects the list from modification.

If the list is not const, GetAt returns a reference to the element. This allows the method to be used on either side of an assignment statement and thus allows the list entries to be modified.

In debug builds, an assertion failure will occur if pos is equal to NULL.

Example

See the example for CAtlList::FindIndex.

Requirements

Header: atlcoll.h

See Also

CAtlList Class
CAtlList::FindIndex