STL queue
- 队列: FIFO 先进先出
- 自适应容器(容器适配器)
- 栈适配器 STL queue
1 2 3 4 5 6 7 8
queue<int, deque<int>> q; queue<int, list<int>> q; q.empty() q.size() q.front() q.back() q.pop() q.push(item)
可以用list和deque做queue
先进先出,后进后出
|
|
优先级队列 priority_queue
- 自适应容器(容器适配器):不能使用list
- 最大值优先级队列、最小值优先级队列(值越大,优先级越高,值越小优先级越高)
- 优先级队列适配器 STL priority_queue
|
|
|
|