CTypedPtrMap

The following is an example of using CTypedPtrMap.

class CRecord {
public:
    int m_Index;
};
typedef CTypedPtrMap <CMapStringToPtr, CString, CRecord *> CRecords;
    CRecords m_Records;
    CString String;
    CRecord *pRecord;
m_Records.SetAt(String, pRecord);
Position = m_Records.GetStartPosition();
while (Position!=NULL) {
    m_Records.GetNextAssoc(Position, String, pRecord);
    TRACE("%s %i\n", String, pRecord->m_Index);
    delete pRecord;
    }
m_Records.RemoveAll();

See my Visual C++ Programmer Stuff page for more C++ stuff.