Can the C++11 std::hash
type be used to hash function pointers? There is a hash
partial specialization defined as
template
I found the following:
17.6.3.4 Hash requirements
A type H meets the Hash requirements if:
- it is a function object type (20.8)
[...]
And then, the referenced 20.8 states:
A function object type is an object type (3.9) that can be the type of the postfix-expression in a function call (5.2.2, 13.3.1.1).228 A function object is an object of a function object type. In the places where one would expect to pass a pointer to a function to an algorithmic template (Clause 25), the interface is specified to accept a function object. This not only makes algorithmic templates work with pointers to functions, but also enables them to work with arbitrary function objects.
It kind of states it backwards... but the statement not only makes algorithmic templates work with pointers to functions... seems appropriate for your question.