Template Parameters

Both hash_set and hash_multiset have the following template parameters and defaults:

template <class T, class Hash = hash<T>, class Compare = 
   std::equal_to<T>,class Allocator = std::allocator<T> >

class hash_(multi)set;

The first parameter is the type of element the set is to contain. It can be almost any type, but must be copyable.

The second parameter is the hash function used to look up elements. It defaults to the hash function in <hash_fun>. Client code can use hash<T> as is, specialize it, or supply completely different hash function objects or hash function pointers. The hash function must accept a T, and return a size_t.

The third parameter is the comparison function which defaults to std::equal_to<T>. This function should have equality semantics. A specific requirement is that if two keys compare equal according to Compare, then they must also produce the same result when processed by Hash.

The fourth and final parameter is the allocator, which defaults to std::allocator<T>. The same comments and requirements that appear in the standard for allocators apply here as well.