CMapStringToPtr的插入顺序问题
msdn上有个例子:
CMapStringToOb map;
POSITION pos;
CString key;
CAge* pa;
map.SetAt( "Bart", new CAge( 13 ) );
map.SetAt( "Lisa", new CAge( 11 ) );
map.SetAt( "Homer", new CAge( 36 ) );
map.SetAt( "Marge", new CAge( 35 ) );
// Iterate through the entire map, dumping both name and age.
for( pos = map.GetStartPosition(); pos != NULL; )
{
map.GetNextAssoc( pos, key, (CObject*&)pa );
#ifdef _DEBUG
afxDump << key << " : " << pa << "\n";
#endif
}
The results from this program are as follows:
Lisa : a CAge at $4724 11
Marge : a CAge at $47A8 35
Homer : a CAge at $4766 36
Bart : a CAge at $45D4 13
但是我实在没看出来为什么插入的纪录不是按照顺序读出来的,这其中有什么规律吗?