The list::emplace() is a built-in function in C++ STL which extends list by inserting new element at a given position.
Parameters: The function accepts two mandatory parameters which are described below:
- position – it specifies the iterator which points to the position in the list where the new element is to be inserted.
- args – it specifies the elements to be inserted in the list container.
Return value: It returns a random access iterator which points to the newly inserted element.
Below programs illustrate the above function:
List: 1 2 5 6 7 8 9 10
List: (3, b) (4, a)