Hashtable.this

Constructs a qualified hashtable out of an associative array. Because no allocator was provided, the hashtable will use the GCAllocator.std.experimental.allocator.gc_allocator..

  1. this(A allocator)
  2. this(U assocArr)
    struct Hashtable(K, V)
    this
    (
    U
    this Q
    )
    if (
    is(U == Value[Key],
    Value : V
    Key : K
    )
    )
  3. this(A allocator, U assocArr)

Parameters

assocArr U

an associative array

Complexity: O(m), where m is the number of (key, value) pairs in the associative array.

Examples

import std.algorithm.comparison : equal;

auto h = Hashtable!(int, int)([1 : 10]);
assert(equal(h.keys(), [1]));
assert(equal(h.values(), [10]));

Meta