We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

unordered_set::hash_function

Gets the stored hash function object.

Hash hash_function() const;

The member function returns the stored hash function object.

 

// std_tr1__unordered_set__unordered_set_hash_function.cpp 
// compile with: /EHsc 
#include <unordered_set> 
#include <iostream> 
 
typedef std::unordered_set<char> Myset; 
int main() 
    { 
    Myset c1; 
 
    Myset::hasher hfn = c1.hash_function(); 
    std::cout << "hfn('a') == " << hfn('a') << std::endl; 
    std::cout << "hfn('b') == " << hfn('b') << std::endl; 
 
    return (0); 
    } 
 
hfn('a') == 1630279
hfn('b') == 1647086

Header: <unordered_set>

Namespace: std

Show: