Hashing standard containers

Christopher Jefferson caj@cs.st-andrews.ac.uk
Sat Oct 24 09:09:00 GMT 2009


Unfortunately both TR1 and it looks like C++0x don't provide an  
overload of std::hash for most templated types, including vector,  
list, pair and tuple.

I find this annoying, as (I believe) while it is legal to overload  
std::hash for my own types, it isn't legal to overload it for standard  
types.

I am not sure if technically it is allows as a QoI issue for standard  
libraries to overload std::hash for the standard containers and  
friends, but it does not seem like an unreasonable thing to do, and I  
would like to do it.

Would such code be acceptable, assuming of course it satisfied all  
necessary testing and quality requirements?

Chris



More information about the Libstdc++ mailing list