// Assuming you have a CString -> pointer map like this typedef CMap< CString, LPCSTR, Node*, Node*> CMapStringToNode; // Loop through all elements this way: void interate_thru_cmap(CMapStringToNode &map) { CString strJunk; Node *node; CMap::POSITION pos = map.GetStartPosition(); for (;;) { if (pos == NULL) break; map.GetNextAssoc(pos, strJunk, node); // Do something with node ... } }STL's map<> is easier to work with.
Programming Tips - MFC: How to iterate through a CMap ?
Date: 2008jan21
Update: 2025oct22
Framework: MFC
Language: C/C++
Q. MFC: How to iterate through a CMap<> ?
A.