Function HashTable.byKey

Returns a bidirectional range that iterats over the keys of this HashTable.

HashTable.ByKey byKey() const;

This function always returns a const range, since changing a key of a hash table would probably change its hash value and require rehashing.

Returns

const bidirectional range that iterates over the keys of the container.

See Also

byValue.

Example

HashTable!(string, int) hashTable;
hashTable["one"] = 1;
hashTable["two"] = 2;

auto byKey = hashTable.byKey();
assert(!byKey.empty);

assert(byKey.front == "one" || byKey.front == "two");
assert(byKey.back == "one" || byKey.back == "two");
assert(byKey.front != byKey.back);

byKey.popFront();
assert(byKey.front == byKey.back);

byKey.popBack();
assert(byKey.empty);