unordered_map with valarray as key

David Fang fang@csl.cornell.edu
Mon Oct 28 23:19:00 GMT 2013


> 2013/10/28 Daniel Molina García <unomas@correo.ugr.es>:
>> I'm not sure if my code is valid, but I think that unordered_map is not
>> working ok with valarray as key.
>
> Correct. The code is invalid, because the standard does not specify a
> specialization of std::hash for std::valarray.
>
> - Daniel

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.

Fang


More information about the Libstdc++ mailing list