Map::InsertReplace
Defined in: C4Map.h
Adds an object to a map and replaces an existing object having the same key.
Prototype
type *InsertReplace(type *element);
Parameters
element |
A pointer to the object to add to the map.
|
Description
The InsertReplace function adds the object specified by the element parameter to a map. If an object having the same key is already a member of the map, then it is replaced by the new object being inserted. The old object is removed from the map, and a pointer to it is returned. If no object is replaced, then the return value is nullptr.
If the object being inserted is a member of a different map, then it is first removed from that map before being added to the new map. If the object is already a member of the map for which the InsertReplace function is called, then no action is taken, and the return value is nullptr.
See Also
Map::Insert
Map::Find
|