C4 Engine
C4 Engine API Documentation

Map::InsertReplaceMapElement

Defined in:  TSMap.h
Adds an object to a map and replaces an existing object having the same key.
Prototype

type *InsertReplaceMapElement(type *element);

Parameters
element A pointer to the object to add to the map.
Description
The InsertReplaceMapElement 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 of the same type, 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 InsertReplaceMapElement function is called, then no action is taken, and the return value is nullptr.
See Also

Map::InsertMapElement

Map::FindMapElement