'Why can function pointers or lambda expressions be used instead of hash functions in templates of unordered containers?

The following examples are mentioned in 11.4 of <<C + + primer 5th>>:

size_t hasher(const sales_data &sd)
{
    return hash<string>(0)(sd.isbn());
}
bool eqOp(const sales_data &lhs,const sales_data &rhs){
    return lhs.isbn() == rhs.isbn ();
}

Then create the following unordered_multiset container:

using SD_multiset = unordered_multiset<sales_data,
                    decltype(hasher)* , decltype(eqOp)*>;  // why it can?
SD_multiset bookstore(42, hasher, eqOp);

Isn't std:hash a function object? Why can a function pointer or lambda expression be accepted



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source