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::RemoveKey
CMapStringToOb                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  BOOL RemoveKey( const char* key );
 
  Parameter   Description
 
  <key>       Specifies the string used for map lookup.
 
  Remarks
 
  Looks up the map entry corresponding to the supplied key; then, if the
  key is found, removes the entry. This can cause memory leaks if the
  CObject object is not deleted elsewhere.
 
  Return Value
 
  TRUE if the entry was found and successfully removed; otherwise FALSE.
 
  Example
 
  CMapStringToOb map;
 
  map.SetAt( "Bart", new CAge( 13 ) );
  map.SetAt( "Lisa", new CAge( 11 ) );
  map.SetAt( "Homer", new CAge( 36 ) );
  map.SetAt( "Marge", new CAge( 35 ) );
  map.RemoveKey( "Lisa" ); // memory leak: age object not deleted
 
  The results from this program are as follows:
 
  RemoveKey example: A CMapStringToOb with 3 elements
      [Marge] = a CAge at $49A0 35
      [Homer] = a CAge at $495E 36
      [Bart] = a CAge at $4634 13
 
  See Also
 
  CMapStringToOb::RemoveAll
 
 
                                     -♦-