HashTable.byValue

Returns a bidirectional range that iterats over the values of this $(D_PSYMBOL HashTable).

  1. ByValue byValue()
    struct HashTable(Key, Value, alias hasher = hash)
    byValue
    ()
    if (
    isHashFunction!(hasher, Key)
    )
  2. ConstByValue byValue()

Return Value

Type: ByValue

A bidirectional range that iterates over the values of the container.

Examples

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

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

assert(byValue.front == 1 || byValue.front == 2);
assert(byValue.back == 1 || byValue.back == 2);
assert(byValue.front != byValue.back);

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

byValue.popBack();
assert(byValue.empty);

See Also

$(D_PSYMBOL byKey).

Meta