Function HashTable.remove
Removes the element with the key key.
size_t remove
(
Key key
);
The method returns the number of elements removed. Since
the hash table contains only unique keys, remove always
returns 1
if an element with the key was found, 0
otherwise.
Parameters
Name | Description |
---|---|
key | The key to be removed. |
Returns
Number of the removed elements.
Example
HashTable!(string, int) hashTable;
hashTable["Euoplocephalus"] = 6;
assert("Euoplocephalus" in hashTable);
assert(hashTable .remove("Euoplocephalus") == 1);
assert(hashTable .remove("Euoplocephalus") == 0);
assert("Euoplocephalus" !in hashTable);