On 10/24/2012 12:17 PM, Mehrdad wrote: > I couldn't find a better title, sorry. > > > But yeah, I've spent too many hours on hunting down problems like these... > > > Could someone explain what's going on? Thanks! > > import std.stdio; > struct S { int[int] aa; } > void main() > { > writeln( [1: 2] == [1: 2] ); // true > writeln(S([1: 2]) == S([1: 2])); // false > } > > (I'm on Windows DMD v2.060.)
The compare for associative arrays is to compare the members. The default compare for structs is a bit compare of the contents.