C++ Deque emplace()C++ Deque emplace() function inserts a new element just before the specified position and the size of the container is increased by one. SyntaxParameterposition: It defines the position before which the new element is to be inserted. val: New value which is to be inserted. Return valueIt returns an iterator to the newly constructed element. Example 1Let's see a simple example Output: 1 7 8 4 5 In this example, emplace() function inserts a new element i.e 1 in the beginning of the deque. Example 2Let's see a simple example Output: C++ In this example, emplace() function inserts a new element i.e '+' at second position.
Next TopicC++ Deque
|