"insert" (mapping::insert)

Insert a key/value pair.

Synopsis

int mapping.insert(T key, T value);

Parameters

Parameter Description
key Mapping key
value Given value

Description

Insert a key/value pair. If the key is already in the mapping, the given value will replace the existing one.

Example

main()
{
  mapping m = makeMapping("city", "Vienna");
  m.insert("country", "Austria");
  DebugN(m); // [mapping 2 items "city":"Vienna", "country":"Austria"]
  m.insert("city", "Graz"); // replaces existing value
  DebugN(m["city"]); // "Graz"
}

Assignment

Mapping