Add an element to a container by reference in place, if it does not exist yet.
Usage
try_emplace(x, value, key)
Value
Invisibly returns NULL.
Arguments
x
A CppMap or CppUnorderedMap object.
value
A value to add to x.
key
A key to add to x.
Details
Existing container values are not overwritten. I.e., inserting a key-value pair into a map that already contains that key preserves the old
value and discards the new one. Use insert_or_assign to overwrite values.
emplace and try_emplace produce the same results in the context of this package. try_emplace can be minimally more computationally
efficient than emplace.