I tried to get an example a few weeks ago when I needed a binary search
tree - I was shocked to find that MFC/VC++ has no built in BST or BT and
that you have to use CMap. The documentation of CMap is so bad that I
eventually gave up and used CObList's instead since speed was not a big
issue. If you succeed in finding a simple example please forward it to me
and maybe I'll re-implement my CObLists as a CMap.
Regards,
..matthew
// declare it
CMyMap myMap;
// use it
// find data element
//BOOL Lookup( ARG_KEY key, VALUE& rValue ) const;
MyClass* pMyClass = NULL;
myMap.Lookup("Hello", pMyClass);
// set data element (add or replace)
//void SetAt( ARG_KEY key, ARG_VALUE newValue );
myMap.SetAt("Hello", pMyClass);
// iterate map
CString aKeyName;
for(POSITION Pos = myMap.GetStartPosition(); Pos != NULL; )
{
myMap.GetNextAssoc( Pos, aKeyName, pMyClass );
// ...
}
Hope this helps.
Regards,
Gregory Malocha.
Sezam Technologies.
Dr. Harald Busch wrote in message <35D2B39E...@hl.siemens.de>...
>Hi,
>has anybody got a simple example for something like
>CMap<CString,CString, MyClass*, MyClass*&> ?
>Thanks
>Harald
>
>harald-...@hl.siemens.de
>