//queue STL
//queue is just a container adaptor, which is a class that use other container.
//just like stack
q1.push(x) //push x into the queue
q1.pop() //pop the first element in the queue
q1.front() //return the first element in the queue
q1.back() //return the last element in the queue
q1.empty()
q1.size() //C++11
q1.emplace(x) //add a new element at the end of the queue, after its current last element //the differences between emplace and push
//though they are both the functions to add elements in the queue
//if you use emplace ,you will not make a new class.
//Let's see a example
struct node
{
int x, y; node(int a, int b) :x(a), y(b){}
}; int main()
{
queue<node>q1,q2;
q1.emplace(1, 2);
q2.push(node(1, 2)); cout << q1.front().x << endl; return 0;
}

  

queue STL的更多相关文章

  1. POJ 3481 Double Queue(STL)

    题意  模拟银行的排队系统  有三种操作  1-加入优先级为p 编号为k的人到队列  2-服务当前优先级最大的   3-服务当前优先级最小的  0-退出系统 能够用stl中的map   由于map本身 ...

  2. Team Queue(STL练习题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1387 Team Queue Time Limit: 2000/1000 MS (Java/Others ...

  3. ZOJ2724_Windows Message Queue(STL/优先队列)

    解题报告 题意: 看输入输出就非常明确. 思路: 优先队列. #include <algorithm> #include <iostream> #include <cst ...

  4. 150723培训心得(queue)

    queue(STL中函数,就是指队列) #include <iostream> #include <queue> using namespace std;        //这 ...

  5. 数组、链表、栈、队列和STL

    数组 数组是一种最基本的数据结构,它是内存上的一块连续存储空间.正因如此数组的随机访问很方便.但数组也有其固有的限制,大小分配后不能改变. STL中的数组 STL中的Array是静态数组模板,就是我们 ...

  6. C++学习注意点

    1.cin,cout关同步再用,不然效率很糟cin,cout关同步再用,不然效率很糟cin,cout关同步再用,不然效率很糟.重要的事情说三遍.关同步代码:std::ios::sync_with_st ...

  7. C语音常用库和函数

    #include <assert.h> //设定插入点 #include <ctype.h> //字符处理 #include <errno.h> //定义错误码 # ...

  8. C/C++头文件一览

    C.传统 C++ #include <assert.h> //设定插入点 #include <ctype.h> //字符处理 #include <errno.h> ...

  9. linux常用头文件

    http://blog.csdn.net/kokodudu/article/details/17361161 aio.h 异步I/Oassert.h 验证程序断言 complex 复数类complex ...

随机推荐

  1. 循序渐进看Java web日志跟踪(3)-Log4J的使用和配置

    之前说过关于java日志跟踪的几大主要用的框架,也说到了,其实在其中,Log4J充当着一个相当重要的角色.目前,大部分框架也都是采用的是Log4J,虽然说它已经停止了更新,作者也重新起了LogBack ...

  2. NGUI中的Tween的委托使用

    public TweenPosition tweenIn; public TweenScale tweenOut; EventDelegate In = new EventDelegate(this, ...

  3. Lua math库

    函数名 描述 示例 结果 pi 圆周率 math.pi 3.1415926535898 abs 取绝对值 math.abs(-2012) 2012 ceil 向上取整 math.ceil(9.1) 1 ...

  4. C# 语言规范_版本5.0 (第13章 接口)

    1. 接口 一个接口定义一个协定.实现某接口的类或结构必须遵守该接口定义的协定.一个接口可以从多个基接口继承,而一个类或结构可以实现多个接口. 接口可以包含方法.属性.事件和索引器.接口本身不提供它所 ...

  5. [其他]win7下chrome浏览器插件导出与导入

    下载了某些插件,重装电脑怎么不备份,重装之后怎么再次使用,一文搞定! 导出crx格式备份文件 1.选择 自定义格式及控制 > 更多工具 > 扩展程序: 2.勾选"开发者模式&qu ...

  6. Error(10028)

    两个进程里都有同一个条件判断的话,会产生并行信号冲突的问题. 同一个信号不允许在多个进程中赋值,否则则为多驱动. 进程的并行性决定了多进程不同能对同一个对象进行赋值.

  7. [WPF] 为Style 里的button添加鼠标点击响应事件

    一个TabControl, 用的是PagedTabControl style, 在style中有个button, button在style里已经写了click事件,但是现在还需要加上一段功能,就是在响 ...

  8. uiscrollview 事件冲突

    self.scrollView.panGestureRecognizer.delaysTouchesBegan = YES;设置scrollView的延迟接收点击触摸事件,关闭触摸事件 self.sc ...

  9. 【实验室笔记】zedgraph控件属性总结

    //图表的X轴刻度线是否显示 this.zedGraphControl1.GraphPane.XAxis.MajorGrid.IsVisible = true; //图表的X轴刻度线的颜色 this. ...

  10. 使用SyncToy 同步两台机器上的文件夹

    @echo off echo 准备启动同步... net use \\WIN-AJH8QENQQGK "123456" /user:Administrator Z:\SyncToy ...