English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C++ Deque (Double-ended Queue)
C ++ The Deque crend() function is used to return an iterator pointing to the element before the first element of the deque container. The iterator can be incremented or decremented, but cannot modify the content of the deque.
const_reverse_iterator crend();
It does not contain any parameters.
It returns a constant reverse iterator that refers to the element before the first element of the deque container.
Let's look at a simple example
#include<iostream> #include<deque> using namespace std; int main() { deque<char> c = {'l', 'a', 'p', 't', 'o', 'p'}; deque<char>::const_reverse_iterator citr = c.crbegin(); cout << "Reverse deque:"; while(citr != c.crend()) { cout<<*citr; ++citr; } return 0;
Output:
Reverse deque: potpal
In this example, the while loop iterates until citr is not equal to c.crend().