CMap::Lookup

BOOLLookup(ARG_KEYkey,VALUE&rValue)const;

Return Value

Nonzero if the element was found; otherwise 0.

Parameters

ARG_KEY

Template parameter specifying the type of the key value.

key

Specifies the key that identifies the element to be looked up.

VALUE

Specifies the type of the value to be looked up.

rValue

Receives the looked-up value.

Remarks

Lookup uses a hashing algorithm to quickly find the map element with a key that exactly matches the given key.

Example

CMap<int,int,CPoint,CPoint> myMap;
   int i;

   myMap.InitHashTable( 257 );

   // Add 10 elements to the map.
   for (i=0;i < 200;i++)
      myMap[i] = CPoint(i, i);

   // Remove the elements with even key values.
   CPoint pt;
   for (i=0; myMap.Lookup( i, pt ) ;i+=2)
   {
      myMap.RemoveKey( i );
   }

#ifdef _DEBUG
   ASSERT(myMap.GetCount() == 100);
    afxDump.SetDepth( 1 );
    afxDump << "myMap: " << &myMap << "\n";
#endif

CMap OverviewClass MembersHierarchy Chart

See Also   CMap::operator []