Javatpoint Logo
Javatpoint Logo

C++ Deque crbegin()

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

Where, crbegin() stands for constant reverse beginning.

Syntax

Parameter

It does not contain any parameter.

Return value

It returns a constant reverse iterator pointing to the last element in the deque container.

Example 1

Let's see a simple example

Output:

50 40 30 20 10 

In this example, crbegin() function is used to return an iterator of the last element and for loop is iterated till it reaches the first element of the deque.

Example 2

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

Output:

mechanical

In this example, constant reverse iterator is incremented by one. Therefore, it access the second element from backwards.


Next TopicC++ Deque



Please Share

facebook twitter google plus pinterest