mobile wallpaper 1
mobile wallpaper 2
mobile wallpaper 3
mobile wallpaper 4
145 words
1 minute
queue容器 - CPP STL
2026-10-10

queue基本概念#

概念:Queue是一种先进先出(First In,First Out,FIFO)的数据结构,它有2个出口

queue

队列容器允许从一端添加新元素,从另一端移除元素

队列中只有队头和队尾才可以被外界使用,因此队列不允许有遍历行为

队列中进数据 — 入队push

队列中出数据 — 出队pop

queue常用接口#

功能描述:#

栈容器常用的对外接口

函数原型:#

构造函数

queue<T> que; //queue采用类模板实现,queue对象的默认构造函数
queue(const queue &que); //拷贝构造

赋值操作

queue& operator=(const queue &que); //重载=

数据存取

push(elem); //往队尾添加元素
pop(); //移除队头第一个元素
back(); //返回最后一个元素
front(); //返回第一个元素

大小操作

empty();
size();

Video#

Share

If this article helped you, please share it with others!

queue容器 - CPP STL
https://www.bilibili.com/video/BV1et411b73Z/?p=213
Author
Memki
Published at
2026-10-10
License
CC BY-NC-SA 4.0

Some information may be outdated

Table of Contents