Javatpoint Logo
Javatpoint Logo

C++ Queue emplace() Function

C++ Queue emplace() function adds a new element at the end of the queue, following the current back element. The function performs the insertion operation on the queue.

Syntax

Parameters

args: The parameter forwards the argument for the construction of a new element. It specifies the value of the newly constructed element, which is to be inserted at the end position.

Return value

The function is used only for the addition of new elements and does not return any value.

Example 1

Output:

I am the first line
I am the second one

Example 2

Output:

Javatpoint is a computer science portal

Complexity

One call is made to the emplace_back.

Data races

All the elements present in the queue are modified, as with the addition of a new element the respective positions of all the other elements are also changed.

Exception Safety

Guarantee as equivalent to the operations that are performed on the underlying container object is provided.

Next TopicC++ Queue





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA