Export (0) Print
Expand All

CObList::Find

Searches the list sequentially to find the first CObject pointer matching the specified CObject pointer.

POSITION Find( 
   CObject* searchValue, 
   POSITION startAfter = NULL  
) const;

searchValue

The object pointer to be found in this list.

startAfter

The start position for the search.

A POSITION value that can be used for iteration or object pointer retrieval; NULL if the object is not found.

Note that the pointer values are compared, not the contents of the objects.

The following table shows other member functions that are similar to CObList::Find.

Class

Member Function

CPtrList

POSITION Find( void* searchValue, POSITION startAfter = NULL ) const;

CStringList

POSITION Find( LPCTSTR searchValue, POSITION startAfter = NULL ) const;

See CObList::CObList for a listing of the CAge class.

CObList list;
CAge* pa1;
CAge* pa2;
POSITION pos;
list.AddHead(pa1 = new CAge(21));
list.AddHead(pa2 = new CAge(40));    // List now contains (40, 21). 
if ((pos = list.Find(pa1)) != NULL) // Hunt for pa1
{                                  // starting at head by default.
    ASSERT(*(CAge*) list.GetAt(pos) == CAge(21));
}    

Header: afxcoll.h

Community Additions

ADD
Show:
© 2014 Microsoft