Javatpoint Logo
Javatpoint Logo

C++ Deque cend()

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

If the container is empty then cend() function returns the same as cbegin() function.

Syntax

Parameter

It does not contain any parameter.

Return value

It returns a constant iterator referring to the past-the-last element in a deque.

Example 1

Let's see a simple example when deque containing character values.

Output:

j a v a T p o i n t 

In this example, cend() function is used to iterate throughout the deque container and the while loop executes until and unless 'itr' becomes equal to the ch.cend().

Example 2

Let's see a simple example when deque contains integer values.

Output:

100 200 300 400 500

In this example, cend() function is used to iterate throughout the deque container and the while loop executes until and unless 'itr' becomes equal to the ch.cend().


Next TopicC++ Deque



Help Others, Please Share

facebook twitter pinterest