C++ List emplace()C++ List emplace() function inserts new element at a specified position and the size of the list is increased by one. SyntaxParameterpos: It defines the position where the new element is to be inserted. val: New value to be inserted at a specified position. Return valueIt returns an iterator pointing to the newly constructed element. Example 1Let's see a simple example when the new element is inserted in between the list. Output: java In this example, emplace() function adds a new character at second position Example 2Let's see a simple example when the new element is added at the end of the list. Output: java is a programming language In this example, emplace() function adds a new string i.e "programming language" at the end of the list. Next Topicemplace_back() 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