These functions return useful iterators to access vector elements in reverse order (from end to beginning)
It’s a public member function that returns a const_reverse_iterator pointing to the element preceding the first element.
A const_reverse_iterator to the reverse end of the sequence.
const_reverse_iterator crend() const noexcept;
It returns a const_reverse_iterator pointing to the last element in the container (i.e., its reverse beginning)..
A const_reverse_iterator to the reverse beginning of the sequence.
const_reverse_iterator crbegin() const noexcept;
50 40 30 20 10
Returns a reverse iterator to the element following the last element of the reversed container. It corresponds to the element preceding the first element of the non-reversed container. This element acts as a placeholder, attempting to access it results in undefined behavior
Returns a reverse iterator to the first element of the reversed container. It corresponds to the last element of the non-reversed container.
Both are used in deque operations, concurrently accessing or modifying different elements is safe.
The copy construction or assignment of the returned iterator is also guaranteed to never throw exception.
- Difference between Virtual function and Pure virtual function in C++
- cin get() in C++ with Examples
- Difference between Increment and Decrement Operators
- Map of Vectors in C++ STL with Examples
- Problem in comparing Floating point numbers and how to compare them correctly?
- exit(0) vs exit(1) in C/C++ with Examples
- C++ program to print all Even and Odd numbers from 1 to N
- Reverse the content of a file and store it in another
- Minimum cells to be flipped to get a 2*2 submatrix with equal elements
- Nested Loops in C++ with Examples
- _Find_first() function in C++ bitset with Examples
- _Find_next() function in C++ bitset with Examples
- Left-Right traversal of all the levels of N-ary tree
- Difference between Iterators and Pointers in C/C++ with Examples
- ostream::seekp(pos) method in C++ with Exmaples
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.
Improved By : Anish Kumar Arya