[精华版STL]

//STL 数据结构
#include<queue>//队列,堆
#include<stack>//栈
#include<map>//map
#include<string>
using namespace std;
queue<int> que;//队列
stack<int> sta;//栈
priority_queue<int>heap;//堆
map<int,int>ma;//map
map<int, map<int,int>/*空格*/ >ha;//二维
map<string,int>mas;//map
int main()
{
队列
{
que.push(3);//进入
int duitou=que.front();//队头的人
que.pop();//去掉第一个人
int people=que.size()//队列长度
}

{
sta.push(3);//进入
int zuishang=sta.top();//栈顶
sta.pop();//去掉栈顶的人
int people=sta.size();//栈高度
}

{
heap.push(3);//进入
int zuida=heap.top();//最大值
heap.pop();//去掉最大值
int daxiao=heap.size();//堆大小
}
}

猜你喜欢

转载自www.cnblogs.com/-Wind-/p/10164897.html