WordObjectMap

class WordObjectMap : Map!T(
T
) {}

Members

Functions

get
T[] get(string key)

Return the values given the key. Raise KeyError if key not found.

Examples

string to int

1 auto dictionary = new WordObjectMap!(int)(["one", "two"], [1, 2]);
2 assert(dictionary.get("one") == [1]);
3 assert(dictionary.get("two") == [2]);
4 
5 
6 bool error_thrown = false;
7 try {
8     dictionary.get("three");
9 } catch(KeyError e) {
10     error_thrown = true;
11 }
12 assert(error_thrown);

Meta