On 5/27/12, Jonathan M Davis <jmdavisp...@gmx.com> wrote: > Why can't you have a toHash in your struct?
I mean it doesn't seem to make any difference: import std.stdio; struct Foo { string x; size_t toHash() { return 1; } } void main() { int[Foo] hash; Foo foo1 = Foo("a".idup); Foo foo2 = Foo("a".idup); hash[foo1] = 1; hash[foo2] = 2; writeln(hash); // "[Foo("a"):2, Foo("a"):1]" } > If anything, I find it disturbing > that the code compiles _without_ a definition for opHash in the struct. Wait, is it toHash or opHash? I can't find any documentation of opHash, all I see is a mention of toHash in object.d.