#include <queue>
using namespace std;
queue<元素类型[,底层容器类型]> 队列对象(构造实参表);
底层容器:deque(默认)/list
push -> push_back
pop -> pop_front
back -> back
front -> front
size -> size
empty -> empty
clear -> clear
#include <iostream> #include <queue> #include <list> using namespace std; int main (void) { // queue<string, list<string> > qs; queue<string> qs; qs.push ("我们"); qs.push ("喜欢"); qs.push ("C++!"); while (! qs.empty ()) { cout << qs.front () << flush; qs.pop (); } cout << endl; return 0; }