This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: unordered_map with valarray as key


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]