你是否指的是CMap这个模板类
CMap<int,int,CPoint,CPoint> myMap; // Add 10 elements to the map.
for (int i=0;i < 10;i++)
myMap.SetAt( i, CPoint(i, i) ); // Remove the elements with even key values.
POSITION pos = myMap.GetStartPosition();
int nKey;
CPoint pt;
while (pos != NULL)
{
myMap.GetNextAssoc( pos, nKey, pt ); if ((nKey%2) == 0)
myMap.RemoveKey( nKey );
}
MSDN的例子,key要自己输入一个,也就是上边for循环里面的i
CMap<int,int,CPoint,CPoint> myMap; // Add 10 elements to the map.
for (int i=0;i < 10;i++)
myMap.SetAt( i, CPoint(i, i) ); // Remove the elements with even key values.
POSITION pos = myMap.GetStartPosition();
int nKey;
CPoint pt;
while (pos != NULL)
{
myMap.GetNextAssoc( pos, nKey, pt ); if ((nKey%2) == 0)
myMap.RemoveKey( nKey );
}
MSDN的例子,key要自己输入一个,也就是上边for循环里面的i
不是这个模板
就是hash_map模板
它可以自己设定关键码么?