CAtlList::Find

调用此方法搜索列表所指定的元素。

POSITION Find(
   INARGTYPE element,
   POSITION posStartAfter = NULL 
) const throw( );

参数

  • element
    在列表中找到的元素。

  • posStartAfter
    搜索的起始位置。如果未指定任何值,搜索从head元素。

返回值

返回元素的位置值,否则如果找到,则返回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

请参见

参考

CAtlList选件类

CAtlList::FindIndex