Virus721
Virus721

Reputation: 8335

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.

Upvotes: 1

Views: 1446

Answers (1)

nvoigt
nvoigt

Reputation: 77304

CMap<string, FILE*>

and

CMap<string, unsigned long>

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

Upvotes: 2

Related Questions