Javatpoint Logo
Javatpoint Logo

C++ Deque rend()

C++ Deque rend() function returns a reverse iterator referring to the element preceding the first element in the deque container. An iterator can be incremented or decremented just like end() function.

Where, rend() stands for reverse end.

C++ Deque rend

Syntax

Parameter

It does not contain any parameter.

Return value

It returns a reverse iterator pointing to the reverse end of the deque container.

Example 1

Let's see a simple example

Output:

lairotuT	

In this example, reverse iterator is used to iterate from backwards and it iterates until and unless it becomes equal to the c.rend().It prints the reverse content of a deque c i.e lairotuT

Example 2

Let's see a simple example when reverse iterator is decremented by 2.

Output:

2

In this example, reverse iterator is decremented by 2. Therefore, it access the second element of deque.


Next TopicC++ Deque



Please Share

facebook twitter google plus pinterest