C++ List assign()C++ List assign() function assigns new contents to the list container and replaces the old one with a new one. SyntaxParameterfirst,last: It defines the range of the elements that are to be copied. n: It specifies the new size of the container. val: New value which is to added in a newly constructed space. Return valueIt does not return any value. Example 1Let's see a simple example Output: 10 10 10 In this example, assign() function replaces the old content with a new content. It assigns '10' value 3 times in the list container. Example 2Let's see a simple example Output: C++ In this example, assign() function assigns the first list to the second list. Next Topicemplace() Function |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India