unordered_map with valarray as key
Jonathan Wakely
jwakely.gcc@gmail.com
Tue Oct 29 00:40:00 GMT 2013
On 28 October 2013 23:18, David Fang wrote:
>
> However, nothing stops one from providing a specialization of
> std::hash<std::valarray<> >. You could look at hash<std::string> ro
> hash<const char*> as a starting point.
That's not true, it's undefined behaviour to specialize templates from
namespace std unless the specialization depends on one or more
user-defined types, so it is not allowed to specialize
std::hash<std::valarray<long>>. The alternative is to define your own
hash function (not a specialization of std::hash) and use that with
the unordered container.
More information about the Libstdc++
mailing list