The std::map::rbegin() is a function in C++ STL. It returns a reverse iterator which points to the last element of the map. The reverse iterator iterates in reverse order and incrementing it means moving towards beginning of map.
r_i rbegin(); const_r_i rbegin() const;
Parameters: It does not except any parameters.
Returns: It returns a reverse iterator which points to the last element of the map.
Time Complexity: O(1)
Below examples illustrate the map::rbegin() method:
Map contains following elements in reverse order e = 5 d = 4 c = 3 b = 2 a = 1
Map contains following elements in reverse order e = E d = D c = C b = B a = A
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- map rbegin() function in C++ STL
- deque rbegin() function in C++ STL
- multiset rbegin() and rend() function in C++ STL
- vector rbegin() and rend() function in C++ STL
- list rbegin() and rend() function in C++ STL
- multimap rbegin in C++ STL
- set::rbegin() and set::rend() in C++ STL
- array::rbegin() and array::rend() in C++ STL
- Function Overloading vs Function Overriding in C++
- How to call some function before main() function in C++?
- Python - Call function from another function
- How to get the function name inside a function in PHP ?
- How to call function within function in C or C++
- Difference between Virtual function and Pure virtual function in C++
- What happens when a virtual function is called inside a non-virtual function in C++