Hash_Map module

delete

procedureextensionsince 0.23.0Source

Removes the key. Returns its value (zero if it was missing) and whether it was there.

Example↗
Hash_Map :: #import "Extensions/Hash_Map";

map: Hash_Map.Map(string, int);
defer Hash_Map.deinit(*map);

Hash_Map.insert(*map, "a", 1);
value, removed := Hash_Map.delete(*map, "a");
assert(removed && value == 1 && map.count == 0);
delete :: (map: *Map, key: map.Key) -> (value: map.Value, removed: bool)

Parameters

map: *Map
key: map.Key

Returns

value: map.Value
removed: bool

See also