DTrie

Undocumented in source.

Constructors

this
this(string[] keys, T[] values)
Undocumented in source.

Members

Functions

opIndex
T[] opIndex(string key)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

byKey
IterableKeys byKey [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

auto dictionary = new DTrie!string(["Win", "hot"], ["Lose", "cold"]);
assert(dictionary["Win"] == ["Lose"]);
assert(dictionary["hot"] == ["cold"]);


bool error_thrown = false;
try {
    dictionary["won"];
} catch(KeyError e) {
    error_thrown = true;
}
assert(error_thrown);
auto dictionary = new DTrie!int(["one", "two"], [1, 2]);
assert(dictionary["one"] == [1]);
assert(dictionary["two"] == [2]);

bool error_thrown = false;
try {
    dictionary["three"];
} catch(KeyError e) {
    error_thrown = true;
}
assert(error_thrown);

Multiple strings are available

string[] keys = [
    "すもーくちーず"
];

string[] values = [
    "スモークチーズ"
];

auto dictionary = new DTrie!(string)(keys, values);
assert(dictionary["すもーくちーず"] == ["スモークチーズ"]);

Meta