The std::unordered_map::rehash() is a built in function C++ STL which which sets the number of buckets in container to n or more.
void rehash( size_type s );
- If s is greater than the current buckets into the container then rehashed is done. The new bucket count can be greater than or equal to n.
- If s is less than current bucket count then there may or may not be any effect of function. It totally depends upon compiler
Parameters : It takes New number of buckets into the container.
Return type : Its return type is none.
Size of container : 3 Initial bucket count : 5 Size of container : 3 Now bucket count is : 31
Size of container : 4 Initial bucket count : 7 Size of container : 4 Now bucket count is : 23
- unordered_set rehash() function in C++ STL
- unordered_multiset rehash() function in C++ STL
- unordered_multimap rehash() function in C++ STL
- C++ Program to print an Array using Recursion
- Storage Classes in C++ with Examples
- fill_n() function in C++ STL with examples
- fill() function in C++ STL with examples
- How to erase an element from a vector using erase() and reverse_iterator?
- iomanip setbase() function in C++ with Examples
- iomanip setpricision() function in C++ with Examples
- iomanip setiosflags() function in C++ with Examples
- iomanip setfill() function in C++ with Examples
- Manipulators in C++ with Examples
- iomanip setw() function in C++ with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.