On Thursday, 15 March 2012 at 23:53:26 UTC, H. S. Teoh wrote:
In fact, we can even supply, via UFCS, toHash templates instantiable for *all* structs and classes (doing a naïve hash on the binary
representation of the object).

For a project, I've created something that generated toHash,
opCmp, opEquals and toString methods for a variety of structs. I
needed it to work with tagged unions, so you could declare a
special method that indicated which fields to
hash/compare/stringize.

https://github.com/CyberShadow/RABCDAsm/blob/master/autodata.d

The code may be more complicated than currently necessary, since
it was initially written for D1.

Reply via email to