Strange behavior of opEquals for structs

Ali Çehreli acehreli at yahoo.com
Wed Jun 19 17:15:31 UTC 2019


On 06/19/2019 08:28 AM, harfel wrote:

> Everything works nicely if I compare the structs directly. Yet when they 
> are used as keys in an associative array, the code throws an exception 
> that I do not understand.

You need to define toHash() member function as well:

   https://dlang.org/spec/hash-map.html#using_struct_as_key

Ali


More information about the Digitalmars-d-learn mailing list