
- C++ Library - Home
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- The C++ STL Library
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- The C++ Advanced Library
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ Library -
- C++ STL Library Cheat Sheet
- C++ STL - Cheat Sheet
- C++ Programming Resources
- C++ Programming Tutorial
- C++ Useful Resources
- C++ Discussion
C++ multimap::crbegin() Function
The C++ std::multimap::crbegin() function is used to return a constant reverse iterator to the last element, enabling read-only traversal from the end to the beginning of the container. This function ensures that the elements are accessed in reverse order without allowing modification. It is mainly useful in the secnarios for read-only operations like accessing and inspecting elements in reverse order. The time complexity of this function is constant i.e.O(1).
Syntax
Following is the syntax for std::multimap::crbegin() function.
const_reverse_iterator crbegin() const noexcept;
Parameters
It does not accept any parameter
Return value
This function returns a constant reverse iterator.
Example
Let's look at the following example, where we are going to demonstrate the basic usage of crbegin() function.
#include#include
Output
Output of the above code is as follows −
(3, Namaste)
Example
Consider the following example, where we are going to use crbegin() to iterate over the multimap in reverse order. It iterates until it reaches crend().
#include#include
Output
Following is the output of the above code −
(3, TutorialsPoint) (2, TP) (1, Tutorix)
Example
In the following example, we are going to find the specific element in reverse order.
#include#include
Output
Let us compile and run the above program, this will produce the following result −
Cruze
Example
Following is the example, where we are going to compare the values in the reverse order.
#include#include
Output
If we run the above code it will generate the following output −
Multimaps are equal.