It's unclear to me from the C++11 standard where user-defined hash<T> functors should be defined.
For example, in 23.5.2 Header <unordered_map>, it shows:
template <class Key,
class T,
class Hash = hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<std::pair<const Key, T> > >
class unordered_map;
This suggests that, by default, hash<T> is searched for in the global namespace, whereas equal_to<> is searched for in the std namespace.
Why the difference in namespace between hash<> and equal_to<>?
(Actually, in the description at http://www.cplusplus.com/reference/unordered_map/unordered_map/, neither specifies the std namespace.)
Thus, when defining a hash<> functor for a user type, should we enclose it within a namespace std { } block, or can it remain in the current namespace?
If the code does not have a using namespace std;, how do the STL containers like unordered_map know to look in the std namespace for the predefined hash<> functors associated with the primitive types? It seems like the default Hash = hash<Key> would fail to find these.
Sorry if these are stupid questions..