I am new in C++ and I need your helps.
My goal is to compare some Strings in c++ and store the identical ones. To do this. I hash the Strings to UINT then I will check The UINTS and store the same UINTS. For example.. I have 2000 Documents of texts, each of them has 2 lines. With a hash map I hash them to bunch of UINTS. then I store the same UINTS together. Finally I want to retrieve the identical documents. So, I use the Cmap. which maps the UINTS to their documents. I will do this procedure to increase the memory efficency.
I am using this code:
CString keyExample("This is a sample text");
LPCTSTR lpStr = (LPCTSTR)keyExample;
CMapStringToOb hashObject;
UINT keyExampleTemp=hashObject.HashKey(lpStr);
cout<< keyExampleTemp<<endl;
CMap<UINT, UINT, CString, CString*> mymap;
CString value=mymap[keyExampleTemp];
cout<<value;
If I comment the last 3 lines, I will get a UINT for "This is a sample text", but if I uncomment the last 3 lines, I will get this error which means the problem is with cmap
error C2664:
'CMap<KEY,ARG_KEY,VALUE,ARG_VALUE>::SetAt'
: cannot convert parameter 2 from'CString'
to'ATL::CStringT<BaseType,StringTraits> '