Condividi tramite


CObList::GetAt

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

CObject*& GetAt(
   POSITION position 
);
const CObject*& GetAt( 
   POSITION position  
) const;

Parameters

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

Return Value

See the return value description for GetHead.

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.

The following table shows other member functions that are similar to CObList::GetAt.

Class

Member Function

CPtrList

const void*& GetAt( POSITION position ) const;

void*& GetAt( POSITION position );

CStringList

const CString& GetAt( POSITION position ) const;

CString& GetAt( POSITION position );

Example

See the example for FindIndex.

Requirements

Header: afxcoll.h

See Also

Concepts

CObList Class

CObList Members

Hierarchy Chart

CObList::Find

CObList::SetAt

CObList::GetNext

CObList::GetPrev

CObList::GetHead