#include<iostream>
#include<algorithm>
#include<deque>
#include <iterator> // ostream_iterator
using namespace std;
int main()
{
ostream_iterator<int> output(cout," ");
deque<int> myQueue;
myQueue.push_back(1);
myQueue.push_back(2);
myQueue.push_back(3);
cout<<"The queue is:";
copy(myQueue.begin(),myQueue.end(),output);cout<<endl;
myQueue.push_front(0);
cout<<"The queue is:";
copy(myQueue.begin(),myQueue.end(),output);cout<<endl;
cout<<"Front value is:";
cout<<myQueue[0];cout<<endl;
myQueue.pop_front();
cout<<"After pop_front, the queue is:";
copy(myQueue.begin(),myQueue.end(),output);cout<<endl;
system("pause");
return 0;
}
STL 队列
最新推荐文章于 2023-02-26 13:22:49 发布