STL Queue
STL Queue
FIFO
包含头文件<queue>
定义
1 | namespace std { |
内部Container默认使用deque实现的。
可以使用其他提供front(), back(), push_back(), pop_front()的顺序容器,如list。
The Core Interface
- push() inserts an element into the queue.
- front() returns the next element in the queue (the element that was inserted first).
- back() returns the last element in the queue (the element that was inserted last).
- pop() removes an element from the queue.
- size()/empty()
Example of Using Queues
1 |
|
[1] The C++ Standard Library 2nd Edition