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.



(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


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


6 6 6 6 6 

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

Next TopicC++ Deque

Help Others, Please Share

facebook twitter pinterest