The hash class is default constructible, which means that one can construct this object without any arguments or initialization values. It is used to get the hash value of the argument that is being passed to it. If the argument doesn’t change, the value doesn’t change either.
template <class T> struct hash;
Syntax to create object:
hash<class template> object-name
Member functions: This Hash class only has one member function:
- operator(): It returns hashed value for given argument.
Below is the implementation of the hash class:
String hash values: 4457761756728957899 Bitset 10101 hash value: 17123654466142159564 Vector
hash value: 16935082123893034051 Char hash values: 97
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Difference between Base class and Derived class in C++
- How to convert a class to another class type in C++?
- std::any Class in C++
- std:: valarray class in C++
- Array class in C++
- Structure vs class in C++
- std::uniform_int_distribution class in C++
- std::string class in C++
- How to implement our own Vector Class in C++?
- std::bad_weak_ptr class in C++ with Examples
- std::is_trivially_copy_assignable class in C++ with Examples
- std::bad_array_new_length class in C++ with Examples
- Virtual base class in C++
- Difference between namespace and class
- C++ String Class and its Applications | Set 2
- C++ string class and its applications
- Why is the size of an empty class not zero in C++?
- Simulating final class in C++
- What all is inherited from parent class in C++?
- Friend class and function in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.