public member function
template <class... Args> void emplace (Args&&... args);
Construct and insert element
Adds a new element at the end of the queue, after its current last element. This new element is constructed in place passing args as the arguments for its constructor.
This member function effectively calls the member function emplace_back of the underlying container, forwarding args.
- Arguments forwarded to construct the new element.
#include <iostream> // std::cin, std::cout
#include <queue> // std::queue
#include <string> // std::string, std::getline(string)
int main ()
myqueue.emplace ("First sentence");
myqueue.emplace ("Second sentence");
std::cout << "myqueue contains:\n";
std::cout << myqueue.front() << '\n';
One call to emplace_back on the underlying container.
The container and up to all its contained elements are modified.
Provides the same level of guarantees as the operation performed on the underlying container object.
- Insert element (public member function
- Remove next element (public member function