Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CMapStringToOb::RemoveAll
CMapStringToOb                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  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
 
  {
      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
 
 
  See Also
 
  CMapStringToOb::RemoveKey
 
 
                                     -♦-