C++ Queue emplace() FunctionLast Updated : 17 Mar 2025 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. SyntaxParametersargs: 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 valueThe function is used only for the addition of new elements and does not return any value. Example 1Output: I am the first line I am the second one Example 2Output: Javatpoint is a computer science portal ComplexityOne call is made to the emplace_back. Data racesAll 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 SafetyGuarantee as equivalent to the operations that are performed on the underlying container object is provided. Next TopicC++ Queue |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India