
On 2 Dec 2014 at 15:38, Howard Hinnant wrote:
Actually we need a new std::safe_hash<> I think, one explicitly prohibited from being a trivial hash. I'd personally like to see that become the default hash for unordered_map et al, and let the programmer choose std::hash where safe.
I´d like to see us enable the programmer to *easily* select hash algorithms we haven´t even heard of yet. E.g. perhaps they are being invented tomorrow.
I didn't raise N3980 because I personally think it's orthogonal to the use cases for std::hash (and, for reference, I would be a *huge* supporter of N3980). I'd really like if it were possible to declare that for all unordered_map<> used in a namespace X that the default hash used is some type Y. One could evilly achieve this using a local namespace bind like this: namespace X { template<class Key, class T, class Hash=Y<Key>, ...> using unordered_map = std::unordered_map<Key, T, Hash, ...>; } ... but I'd personally prefer if every user of unordered_map were *required* to choose their hash via binding above, and the std implementation doesn't default a hash. I guess backwards compatibility will probably prevent that being possible sadly, unless we deprecate unordered_map for something better in the STL of course. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/