共用方式為


CList::FindIndex

使用 nIndex 內的值當做索引清單。

POSITION FindIndex(
   INT_PTR nIndex 
) const;

參數

  • nIndex
    要尋找之清單項目的以零起始的索引。

傳回值

可以針對反覆項目或物件指標擷取使用的 位置 值; NULL ,如果 nIndex 是負值或太大。

備註

啟動執行掃描 清單的開頭,停止在 第 n 個項目。

範例

// 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)));      

需求

Header: afxtempl.h

請參閱

參考

CList 類別

階層架構圖

CObList::Find

CObList::GetNext

CObList::GetPrev