hash for floating
Paolo Invernizzi
arathorn at fastwebnet.it
Sat Jun 15 03:13:25 PDT 2013
Hi all,
How to implement a proper hash method for a struct/class having
as a base one or more floating point?
When I compile with the -w flags, dmd 2.063 tells me that the
function must be size_t toHash() const nothrow @safe.
The point is that the nothrow doesn't permit the std.conv.to
conversions, while the @safe does not permit the cast().
So how to perform a little math on the floating and then turning
the result to a proper integer hash?
Suggestions welcome! Thank!
Paolo Invernizzi
More information about the Digitalmars-d-learn
mailing list