CList::FindIndex

POSITIONFindIndex(intnIndex**)const;**

Return Value

A POSITION value that can be used for iteration or object pointer retrieval; NULL if nIndex is negative or too large.

Parameters

nIndex

The zero-based index of the list element to be found.

Remarks

Uses the value of nIndex as an index into the list. It starts a sequential scan from the head of the list, stopping on the nth element.

Example

// Define myList.
CList<CString,CString&> myList;

// Add three elements to the list.
myList.AddTail(CString("XYZ"));
myList.AddTail(CString("ABC"));
myList.AddTail(CString("123"));

// Verify the first element (index 0).
ASSERT(CString("XYZ") == myList.GetAt(myList.FindIndex(0)));

// Verify the third element (index 2).
ASSERT(CString("123") == myList.GetAt(myList.FindIndex(2)));

CList OverviewClass MembersHierarchy Chart

See Also   CObList::Find, CObList::GetNext, CObList::GetPrev