void RemoveAll( );
Remarks
Removes all the elements from this map and destroys the CString key objects. The CObject objects referenced by each key are not destroyed. The RemoveAll function can cause memory leaks if you do not ensure that the referenced CObject objects are destroyed.
The function works correctly if the map is already empty.
Example
See CObList::CObList for a listing of the CAge
class used in all collection examples.
// example for CMapStringToOb::RemoveAll
{
CMapStringToOb map;
CAge age1( 13 ); // Two objects on the stack
CAge age2( 36 );
map.SetAt( "Bart", &age1 );
map.SetAt( "Homer", &age2 );
ASSERT( map.GetCount() == 2 );
map.RemoveAll(); // CObject pointers removed; objects not removed.
ASSERT( map.GetCount() == 0 );
ASSERT( map.IsEmpty() );
} // The two CAge objects are deleted when they go out of scope.
CMapStringToOb Overview | Class Members | Hierarchy Chart
See Also CMapStringToOb::RemoveKey