public member function
<queue>
std::queue::emplacetemplate <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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// queue::emplace
#include <iostream> // std::cin, std::cout
#include <queue> // std::queue
#include <string> // std::string, std::getline(string)
int main ()
{
std::queue<std::string> myqueue;
myqueue.emplace ("First sentence");
myqueue.emplace ("Second sentence");
std::cout << "myqueue contains:\n";
while (!myqueue.empty())
{
std::cout << myqueue.front() << '\n';
myqueue.pop();
}
return 0;
}
myqueue contains: First sentence Second sentence
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4