prority queue in +< stl code example
Example: queue stl
#include <iostream>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
queue<int>q;
q.push(10);
q.push(5);
q.push(15);
while(!q.empty())
{
cout<<q.front()<<" ";
q.pop();
}
cout<<endl;
cout<<"_------------------------"<<endl;
q.push(10);
q.push(5);
q.push(15);
queue<int>q2;
q2.push(100);
q2.push(200);
q2.push(300);
q2.push(400);
q.swap(q2);
while(!q.empty())
{
cout<<q.front()<<" ";
q.pop();
}
return 0;
}