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_multiset rehash() function in C++ STL
- unordered_multimap rehash() function in C++ STL
- unordered_set rehash() function in C++ STL
- Generate a random permutation of elements from range [L, R] (Divide and Conquer)
- Count of words that are present in all the given sentences
- Passing and Returning Objects in C++
- Train a Support Vector Machine to recognize facial features in C++
- Salesforce Interview Experience | On-Campus for FTE
- Find two numbers whose divisors are given in a random order
- unordered_set operators in C++ STL
- Dividing a Large file into Separate Modules in C/C++, Java and Python
- How to delete a range of values from the List using Iterator
- How to create a List with Constructor in C++ STL
- How to delete last element from a List in C++ STL