CtypedPtrMap 例子

其生

关注

阅读 40

2022-03-19

 

#include <afxtempl.h>

typedef CTypedPtrMap <CMapStringToPtr, CString, int*> CRecords;

   

CRecords m_Records;
    CString str = "abc";
    int *pRecord = new int(47);
    m_Records.SetAt(str, pRecord);
    POSITION pos = m_Records.GetStartPosition();
    while (pos!=NULL) {
        m_Records.GetNextAssoc(pos, str, pRecord);
        CString strtemp;
        strtemp .Format("%s %d",str, *pRecord);        
        AfxMessageBox(strtemp);
        delete pRecord;
    }
    m_Records.RemoveAll();

精彩评论(0)

0 0 举报