Hi, a C++
noob here. I am trying to tweak some code, with the following key lines (meaning they are not the only ones, but they are the only ones that should matter for this question). By the way, I am using Visual Studio 2010 C++ compiler on Windows.
CMap<ATL::CAtlString,LPCTSTR,UINT,UINT> mapForDuplicates; // "dict" definition
ATL::CAtlString strDescription = ... // let's just say it gets set to a value.
UINT nFound = 0; // What is this for???
BOOL bFound = mapForDuplicates.Lookup(strDescription, nFound);
mapForDuplicates[strDescription] = 1;
Now ... I really do not want to use the UINT
here, as bool
is all I really need. However, I could not figure out what all of the arguments for the CMap constructor really are. When using C#
, all I have to specify is the type of the key and the type of the value. The fact that ATL::CAtlString
does not match LPCSTR
really confuses me. What exactly are KEY
, ARG_KEY
, VALUE
, and ARG_VALUE
? Why do I need all four and can all four be different? Thanks.
...
template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
class CMap : public CObject
...
Note: I could use std::map
here instead(although I have not used it either); the only non-negotiable is ATL::CAtlString
- I have to use this type. Let me know if you have questions.