Stores the value under the key. Returns the value it replaced (zero if there was none) and whether there was one.
Hash_Map :: #import "Extensions/Hash_Map";
map: Hash_Map.Map(string, int);
defer Hash_Map.deinit(*map);
_, replaced := Hash_Map.insert(*map, "a", 1);
assert(!replaced);
previous, replaced2 := Hash_Map.insert(*map, "a", 2);
assert(replaced2 && previous == 1);insert :: (
map: *Map,
key: map.Key,
value: map.Value
) -> (previous: map.Value, replaced: bool)
Parameters
- map: *Map
- key: map.Key
- value: map.Value
Returns
- previous: map.Value
- replaced: bool