Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Returns a CObject pointer based on a CString value.
BOOL Lookup(
LPCTSTR key,
CObject*& rValue
) const;
Parameters
key
Specifies the string key that identifies the element to be looked up.rValue
Specifies the returned value from the looked-up element.
Return Value
Nonzero if the element was found; otherwise 0.
Remarks
Lookup uses a hashing algorithm to quickly find the map element with a key that matches exactly (CString value).
The following table shows other member functions that are similar to CMapStringToOb::LookUp.
Class |
Member Function |
|---|---|
BOOL Lookup( void* key, void*& rValue ) const; |
|
BOOL Lookup( void* key, WORD& rValue ) const; |
|
BOOL Lookup( LPCTSTR key, void*& rValue ) const; |
|
BOOL Lookup( LPCTSTR key, CString& rValue ) const; |
|
BOOL Lookup( WORD key, CObject*& rValue ) const; |
|
BOOL Lookup( WORD key, void*& rValue ) const; |
Example
See CObList::CObList for a listing of the CAge class used in all collection examples.
CMapStringToOb map;
CAge* pa;
map.SetAt(_T("Bart"), new CAge(13));
map.SetAt(_T("Lisa"), new CAge(11));
map.SetAt(_T("Homer"), new CAge(36));
map.SetAt(_T("Marge"), new CAge(35));
ASSERT(map.Lookup(_T("Lisa"), (CObject*&)pa)); // Is "Lisa" in the map?
ASSERT(*pa == CAge(11)); // Is she 11?
Requirements
Header: afxcoll.h