The unordered_map::bucket() is a built-in STL function in C++ which returns the bucket number where the element with the key k is located in the map.
Parameter: The function accepts one mandatory parameter key which specifies the key whose bucket number is to be returned.
Return Value: This method returns an unsigned integral type which represents the bucket number of the key k which is passed in the parameter.
Below program illustrate the unordered_map::bucket() function:
The bucket number of key France is 3
- unordered_multiset bucket() function in C++ STL
- unordered_set bucket() function in C++ STL
- unordered_multimap bucket() function in C++ STL
- Difference between Inheritance and Polymorphism
- Difference between Single and Multiple Inheritance in C++
- Difference between Abstraction and Encapsulation in C++
- return statement in C/C++ with Examples
- How to implement our own Vector Class in C++?
- Web Programming in C++
- 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?
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.