메뉴 닫기

CMap 정렬 관련 Cpair 사용

typedef CMap<int, int, CPoint, CPoint> CMyMap;
CMyMap myMap;
myMap.InitHashTable(257);
// Add 10 elements to the map.
for (int i = 0; i <= 10; i++)
   myMap.SetAt(i, CPoint(i, i));
// Print the element value with even key values.
int nKey = 0;
CPoint pt;
CMyMap::CPair* pCurVal;
pCurVal = myMap.PGetFirstAssoc();
while (pCurVal != NULL)
{
   if ((nKey%2) == 0)
   {
      _tprintf_s(_T("Current key value at %d: %d,%d\n"),
         pCurVal->key, pCurVal->value.x, pCurVal->value.y);
   }
   pCurVal = myMap.PGetNextAssoc(pCurVal);
   nKey++;
}

3 Comments

  1. Kurt Gadomski

    I simply want to tell you that I am just beginner to blogging and really liked this page. Almost certainly I’m want to bookmark your website . You amazingly come with superb articles and reviews. Kudos for revealing your web-site.

댓글 남기기

이메일은 공개되지 않습니다.