
Daniel James wrote:
On 24 February 2011 22:25, Peter Dimov <pdimov@pdimov.com> wrote:
But why is there a definition of hash_value( bool ) when this macro isn't defined? Shouldn't the largest integral types be enough? Even if they aren't, everything below int shouldn't be necessary - it's a standard promotion and it shouldn't be ambiguous to omit bool/char/short.
It looks like it was required for Borland.
From http://article.gmane.org/gmane.comp.lib.boost.devel/119513/
This has led me to question the hash_value design altogether (even though I am the one who came up with it). Relying solely on boost::hash specializations and not on hash_value overloads has the side effect of not allowing conversions, and as this case demonstrates, an unwanted conversion in this context can cause substantial harm, because the code still compiles and runs, causing a 100% collision rate. It seems better to just require an exact specialization.