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()

Syntax

Parameter

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

Return value

It does not return any value.

Example

Let's see a simple example

Output:

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



Please Share

facebook twitter google plus pinterest