C++ Queue emplace() FunctionC++ 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
|
Javatpoint provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India