Creating a CMap which holds another CMap as a valu

2019-07-30 06:54发布

I am trying to create a CMap which has a CString as a key and a CMap as a value. Obviously the following is not working but I have no clue how it is working.

CMap<CString, LPCSTR, CMap<CString, LPCSTR, int, int>, CMap<CString, LPCSTR, int, int>> xyWhatEver;

Anybody has an idea how to implement such a datastructure in c++ using CMap?

1条回答
Ridiculous、
2楼-- · 2019-07-30 07:37

CMap doesn't have copy constructor. I'd suggest using STL classes instead of mfc. Of course you can replace CMap to CMap*, but this will require additional allocating/freeing steps.

typedef CMap<CString, LPCSTR, int, int> tInnerMap;
CMap<CString, LPCSTR, tInnerMap*, tInnerMap*> map; 
查看更多
登录 后发表回答