HashTable.opBinaryRight

Looks for key in this hash table.

struct HashTable(Key, Value, alias hasher = hash)
const
bool
opBinaryRight
(
string op : "in"
T
)
(
auto ref const T key
)
if (
ifTestable!(T, a => Key.init == a)
)
if (
isHashFunction!(hasher, Key)
)

Parameters

T

Type comparable with the key type, used for the lookup.

key T

The key to look for.

Return Value

Type: bool

$(D_KEYWORD true) if key exists in the hash table, $(D_KEYWORD false) otherwise.

Examples

HashTable!(string, int) hashTable;

assert("Shantungosaurus" !in hashTable);
hashTable["Shantungosaurus"] = 15;
assert("Shantungosaurus" in hashTable);

assert("Ceratopsia" !in hashTable);

Meta