![]() |
VOOZH | about |
multiset::rbegin() is a built-in function in C++ STL which returns a reverse iterator pointing to the last element in the multiset container.
Syntax:
reverse_iterator multiset_name.rbegin()
Parameters: The function does not take any parameter.
Return value: The function returns a reverse iterator pointing to the last element in the container.
Below program illustrate the multiset::rbegin() method:
15 15 12 11 10 10 The last element in multiset is 15
multiset::rend() in an inbuilt function in C++ STL which returns a reverse iterator pointing to the theoretical element right before the first element in the multiset container.
Syntax:
reverse_iterator multiset_name.rend()
Parameter: The function does not accepts any parameter.
Return value: The function returns a reverse iterator pointing to the theoretical element right before the first element in the multiset container.
Below program illustrate the multiset::rend() function:
15 15 13 13 11 10
Let us see the differences in a tabular form -:
| multiset rbegin() | multiset rend() | |
| 1. | It is used to return a reverse iterator pointing to the last element in the container | It is used to return a reverse iterator pointing to the theoretical element right before the first element in the multiset container |
| 2. |
Its syntax is -: reverse_iterator rbegin(); |
Its syntax is -: reverse_iterator rend(); |
| 3. | It does not take any parameters. | It does not take any parameters. |
| 4. | Its complexity is constant. | Its complexity does not changes. |
| 5. | Its iterator validity does not changes. | Its iterator validity does not change. |