C++ std::tr1::hash for a templated class
问题 I have this templated class: template <typename T> Thing { ... }; and I would like to use it in an unordered_set: template <typename T> class Bozo { typedef unordered_set<Thing<T> > things_type; things_type things; ... }; Now class Thing has everything it needs except a hash function. I would like to make this generic so I try something like: namespace std { namespace tr1 { template <typename T> size_t hash<Thing<T> >::operator()(const Thing<T> &t) const { ... } }} Attempts to compile this