CList::FindIndex

Wartość nIndex jako indeks do listy.

POSITION FindIndex( 
   INT_PTR nIndex  
) const;

Parametry

  • nIndex
    Indeksu można znaleźć elementu listy.

Wartość zwracana

A stanowisko wartość używany w iteracji lub obiekt wskaźnik pobierania; NULL Jeśli nIndex jest ujemne lub zbyt duży.

Uwagi

Rozpoczyna skanowanie sekwencyjne od szefa liście zatrzymywanie na nth element.

Przykład

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

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

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

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

Wymagania

Nagłówek: afxtempl.h

Zobacz też

Informacje

Klasa CList

Diagram hierarchii

CObList::Find

CObList::GetNext

CObList::GetPrev