MFC equivalent for STL std::map

I need to associate strings to FILE pointers, and strings to unsigned long integers. Using the STL i would simply do :

map<string, FILE *>
map<string, unsigned long int>

But i don't understand how to do the equivalent with MFC CMap.

I tried :

CMap<string, string &, FILE *, FILE * &>
CMap<string, string *, FILE *, FILE **>

But i'm getting errors in both cases : error c2440 typecast cannot convert from std string to DWORD_PTR

Also i'm not sure to understand the logic of having 4 template parameters.

Can anyone explain me please ? Thank you.


CMap<string, FILE*>


CMap<string, unsigned long>

should work fine. The version using 4 parameters is for specialized scenarios only.

Need Your Help

Check class hierarchy at compile on an annotation processor

java annotations jvm annotation-processing

I'm writing an annotation processor to perform the following check at compile time:

Is there a standard in java for _ (underscore) in front of variable or class names?

java coding-style

I have seen some programmers using _ (underscore) in front of class names, and others using it for local variables.