StringMap.this

Constructs an associative array using keys and values.

  1. this(typeof(null) aa)
  2. this(T[string] aa)
  3. this(string[] keys, T[] values)
    struct StringMap(T, U = uint)
    @trusted pure nothrow
    this
    ()
    (
    string[] keys
    ,
    T[] values
    )
    if (
    isMutable!T &&
    !__traits(hasMember, T, "opPostMove")
    &&
    __traits(isUnsigned, U)
    )

Parameters

keys string[]

mutable array of keys

values T[]

mutable array of values Key and value arrays must have the same length.

Complexity: O(n log(n))

Examples

auto keys = ["ba", "a"];
auto values = [1.0, 3.0];
auto map = StringMap!double(keys, values);
assert(map.keys is keys);
assert(map.values is values);

Meta