Javatpoint Logo
Javatpoint Logo

C++ Deque assign()

C++ Deque assign() function assigns new contents to the deque container and the size of the container is modified accordingly.

Syntax

Parameter

(first,last): It defines the range between which the new elements to be inserted.

n: It defines the new size of the deque container.

val: New value to be inserted.

Return value

It does not return any value.

Example 1

Let's see a simple example

Output:

1 2 3 4 

In this example, assign() assigns the content of first container to the second container.

Example 2

Let's see a simple example

Output:

6 6 6 6 6 

In this example, assign() function assigns the value '6' five times to the deq container.


Next TopicC++ Deque



Please Share

facebook twitter google plus pinterest