Re: 'CMap' of 'CString' to 'CString'

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Martin" <martin-g@xxxxxxx> wrote in message
news:1176570681.221570.268650@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello!

I'm trying to create a dictionary with both key and value of type
'CString'. I declare the object of 'CMap' so it is as closer to
std::map, as possible:

CMap<CString, const CString&, CString, const CString&> m_appLangs;

and semantically it's like this:

std::map<std::string, std::string> m_appLangs;


You can use the pre-made class CMapStringToString instead of creating your
own.



But it seems 'CMap' is not realized as an RB-tree, I guess it must be
realized through hash table. The problem is when I make the above
declaration, my source file refuse to compile. Here is the simplified
error message:

cannot convert from 'const CString' to 'DWORD_PTR'
see reference to function template instantiation 'UINT
HashKey<ARG_KEY>(ARG_KEY)' being compiled with
[ARG_KEY=const CString &]


Not sure why this is, maybe it doesn't like either the "const" or the '&'.

-- David


.



Relevant Pages

  • Re: Sorry - basic Q about using char[] instead of CString
    ... I've got a call to an external DLL I'm using LoadLibrary to get. ... lpFUNCTION MyFunc(CString p1, CString p2, short* retVal, CString* retText) ... It is not up to you how to declare the function; you need to know how it is actually declared in the DLL. ...
    (microsoft.public.vc.mfc)
  • Re: How to: optional CString parameter
    ... Then, the question I would ask you is, why force the user of your API to use CString or MFC at all? ... why assume that the user of your API would be using CString. ... a larger API that you might allow other developers to use for various types of projects, then the const CString& approach works great. ...
    (microsoft.public.vc.mfc)
  • Re: fatal error C1001: INTERNAL COMPILER ERROR
    ... forward declare the CString in the header file. ... if there's a repro it can be added to ... > I'm Schobi at suespammers dot org ...
    (microsoft.public.dotnet.languages.vc)
  • CMap of CString to CString
    ... 'CString'. ... I declare the object of 'CMap' so it is as closer to ... But it seems 'CMap' is not realized as an RB-tree, ... Can't I create a map of string to string just ...
    (microsoft.public.vc.mfc)
  • Re: Memory leak in mfc
    ... CString dataRead = CReader.GetData; ... Why do you need a char array at all? ... Why not work directly with the CString? ... that is found in a .h file, but it would make no sense to declare a *variable* in a .h ...
    (microsoft.public.vc.mfc)