CAtlList::Find
呼叫這個方法會搜尋清單中指定的項目。
POSITION Find(
INARGTYPE element,
POSITION posStartAfter = NULL
) const throw( );
參數
element
在清單中找到的項目。posStartAfter
搜尋的開始位置。如果未指定值,搜尋會從標頭項目開始。
傳回值
傳回這個項目的位置值則為,如果找不到,則會傳回 null。
備註
在偵錯組建中,判斷提示失敗,則會產生清單物件無效,或者,如果 posStartAfter 值超出範圍。
範例
// Define the integer list
CAtlList<int> myList;
// Populate the list
myList.AddTail(100);
myList.AddTail(200);
myList.AddTail(300);
myList.AddTail(400);
// Find the '300' element in the list,
// starting from the list head.
POSITION myPos = myList.Find(300);
// Confirm that the element was found
ATLASSERT(myList.GetAt(myPos) == 300);
需求
Header: atlcoll.h