145 words
1 minute
queue容器 - CPP STL
queue基本概念
概念:Queue是一种先进先出(First In,First Out,FIFO)的数据结构,它有2个出口

队列容器允许从一端添加新元素,从另一端移除元素
队列中只有队头和队尾才可以被外界使用,因此队列不允许有遍历行为
队列中进数据 — 入队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 Some information may be outdated
Related Posts Smart