CObList::Find

Syntax

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

Parameters

searchValue

The object pointer to be found in this list.

startAfter

The start position for the search.

Remarks

Searches the list sequentially to find the first CObject pointer matching the specified CObject pointer. Note that the pointer values are compared, not the contents of the objects.

Return Value

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

Example

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

}

See Also

CObList::GetNext, CObList::GetPrev