STL_queue
2014-03-25 15:02
267 查看
queue and priority_queue
push/
pop/
top/
emtpy/
size
priority_queue: default to sort the queue as 6.5.4.3, greater stands front
if we wanna ascending order, using__
priority_queue<int, vector<int>, less<int> > pri_que;
#include <iostream>
#include <list>
#include <vector>
#include <queue>
using namespace std;
int main ()
{
int tmp[] = {1,2,3,4};
priority_queue<int> q1(tmp,tmp+4);
priority_queue<int,vector<int>,less<int> > pq; //default to greater
q1.push(1);
q1.push(6);
pq.pop();
cout<<q1.top()<<endl;
pq.size();
pq.empty();
return 0;
}
push/
pop/
top/
emtpy/
size
priority_queue: default to sort the queue as 6.5.4.3, greater stands front
if we wanna ascending order, using__
priority_queue<int, vector<int>, less<int> > pri_que;
#include <iostream>
#include <list>
#include <vector>
#include <queue>
using namespace std;
int main ()
{
int tmp[] = {1,2,3,4};
priority_queue<int> q1(tmp,tmp+4);
priority_queue<int,vector<int>,less<int> > pq; //default to greater
q1.push(1);
q1.push(6);
pq.pop();
cout<<q1.top()<<endl;
pq.size();
pq.empty();
return 0;
}
相关文章推荐
- STL序列式容器之队列——queue
- STL中sort、priority_queue、map、set的自定义比较函数
- STL系列之五 priority_queue 优先级队列
- 如何使用queue? (C/C++) (STL)
- poj3253 Fence Repair 优先队列,C++STL中priority_queue的使用
- C++ stl队列Queue用法介绍:删除,插入等操作代码举例
- STL系列之三 queue 单向队列
- STL Priority_Queue
- C++stl 向量,链表,栈,队列(vector, list, stack, queue)
- STL queue 的使用
- STL--stack/queue的使用方法
- 带你深入理解STL之Stack和Queue
- STL priority_queue
- 《STL源码剖析》-- stl_queue.h
- STL学习之六:queue用法示例
- STL之priority_queue 感觉讲的不错!!!呵呵
- C++每日一练(STL_Queue)
- STL中stack和queue的用法
- STL 标准模板库 vector queue list map multimap的使用基础
- C++ STL学习之queue