std::queue
来自cppreference.com
![]() |
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
定义于头文件 <queue>
|
||
template< class T, |
||
std::queue
类为程序员提供了一个队列功能的容器适配器 - 具体而言,就是一个FIFO(先入先出)的数据结构. 原文:
The
std::queue
class is a container adapter that gives the programmer the functionality of a queue - specifically, a FIFO (first-in, first-out) data structure. The class template acts as a wrapper to the underlying container - only a specific set of functions is provided. The queue pushes the elements on the back of the underlying container and pops them from the front.
目录 |
[编辑] Template parameters
T | - | The type of the stored elements. |
Container | - | The type of the underlying container to use to store the elements. The container must satisfy the requirements of SequenceContainer . Additionally, it must provide the following functions with the usual semantics:
The standard containers std::deque and std::list satisfy these requirements. |
[编辑] 成员类型
成员类型
|
Definition |
container_type
|
Container
|
value_type
|
Container::value_type
|
size_type
|
Container::size_type
|
reference
|
Container::reference
|
const_reference
|
Container::const_reference
|
[编辑] 成员函数
构造queue (公共成员函数) | |
析构 queue (公共成员函数) | |
将值赋给容器适配器 (公共成员函数) | |
| |
访问第一个元素 (公共成员函数) | |
访问最后一个元素 (公共成员函数) | |
| |
检查底层的容器是否为空 (公共成员函数) | |
返回容纳的元素数 (公共成员函数) | |
| |
向队列尾部插入元素 (公共成员函数) | |
(C++11) |
在队尾就地构造元素 (公共成员函数) |
删除第一个元素 (公共成员函数) | |
交换queue 的内容 (公共成员函数) | |
| |
Container c |
底层容器 (受保护的成员对象) |
[编辑] 非成员函数
根据字典顺序比较queue中的值 原文: lexicographically compares the values in the queue (函数模板) | |
特化的std::swap算法 (函数模板) |
[编辑] 辅助类
特化的std::uses_allocator类型特征 (函数模板) |