Article ID: 127194
Article Last Modified on 11/21/2006
template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
void CMap<KEY, ARG_KEY, VALUE, ARG_VALUE>::RemoveAll()
{
ASSERT_VALID(this);
if (m_pHashTable != NULL)
{
// destroy elements (values and keys)
for (UINT nHash = 0; nHash < m_nHashTableSize; nHash++)
{
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL;
pAssoc = pAssoc->pNext)
{
DestructElements(&pAssoc->value, 1);
//NOTE: Additional call to destruct the keys!
DestructElements(&pAssoc->key, 1);
}
}
}
// free hash table
delete[] m_pHashTable;
m_pHashTable = NULL;
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks->FreeDataChain();
m_pBlocks = NULL;
}
Additional query words: CString CMap 3.00 KEY 2.00
Keywords: kbbug kbcode kbcollectionclass kbfix kbnoupdate kbtemplate kbvc200fix KB127194