VOOZH about

URL: https://www.geeksforgeeks.org/cpp/unordered_set-hash_function-in-c-stl/

⇱ unordered_set hash_function() in C++ STL - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

unordered_set hash_function() in C++ STL

Last Updated : 5 Jun, 2023

The unordered_set::hash_function() is a built-in function in C++ STL which is used to get hash function. This hash function is a unary function which takes asingle argument only and returns a unique value of type size_t based on it. 

Syntax:

unordered_set_name.hash_function()

Parameter: The function accepts no parameter. 

Return Value: The function returns the hash function. Below programs illustrate the unordered_set::hash_function() function:

 Program 1

Output:
15276750567035005396
geeks2 geeks1 for

Program 2

Output:
5146686323530302118

Time complexity: O(1)

Comment