Javatpoint Logo
Javatpoint Logo

C++ Deque rbegin()

C++ Deque rbegin() function returns a reverse iterator pointing to the last element of the container. An iterator can be incremented or decremented but it cannot modify the content of deque.

Where, rbegin() stands for reverse beginning.

Note: Reverse iterators are those which iterate from backwards and move towards the beginning of the deque.

C++ Deque rbegin

Syntax

Parameter

It does not contain any parameter.

Return value

It returns a reverse iterator referring to the last element of a deque.

Example 1

Let's see a simple example

Output:

5 4 3 2 1 

In this example, rbegin() function reverses the content of deque by iterating from backwards and moving towards the beginning of the container.

Example 2

Let's see a simple example when reverse iterator is incremented by one.

Output:

C

In this example, reverse iterator is incremented by one. Therefore, rbegin() function access the second element from backwards.


Next TopicC++ Deque



Help Others, Please Share

facebook twitter pinterest