Javatpoint Logo
Javatpoint Logo

C++ List emplace_front()

C++ List emplace_front function adds a new element in the beginning of the list and the size of the container is increased by one.

The following illustration shows how this function works:

C++ List emplace_front()



val: The value which is to be inserted in the beginning of the list.

Return value

It does not return any value.


Let's see a simple example


C is a programming language.

In this example, emplace_front() function adds new different strings in the list li and the output becomes "C is a programming language".

Next Topic

Help Others, Please Share

facebook twitter pinterest