Example under "Using Classes as the KeyType" has some typos (f instead of foo), fix to: class Foo { int a, b; hash_t toHash() { return a + b; } bool opEquals(Object o) { Foo foo = cast(Foo) o; return foo && a == foo.a && b == foo.b; } int opCmp(Object o) { Foo foo = cast(Foo) o; if (!foo) return -1; if (a == foo.a) return b - foo.b; return a - foo.a; } } Example under "Using Structs or Unions as the KeyType" has a typo (s instead of str) fix to: import std.string; struct MyString { string str; const hash_t toHash() { hash_t hash; foreach (char c; str) hash = (hash * 9) + c; return hash; } const bool opEquals(ref const MyString s) { return std.string.cmp(this.str, s.str) == 0; } const int opCmp(ref const MyString s) { return std.string.cmp(this.str, s.str); } }
https://github.com/D-Programming-Language/d-programming-language.org/pull/51