#include <iostream>
#include <deque> //deque容器 双口
using namespace std; void printDeque(deque<int>& d) {
for (deque<int>::iterator it = d.begin(); it != d.end(); it++) {
cout << (*it) << " ";
}
cout << endl;
}
//初始化 构造函数
void test01() {
deque<int> d;
deque<int> d2(, );
deque<int> d3(d2.begin(), d2.end());
deque<int> d4(d3); }
//赋值
void test02() {
deque<int> d1;
d1 = { ,,,, };
deque<int> d2;
d2.assign(d1.begin(),d1.end()); //迭代器指定区间赋值
deque<int>d3;
d3 = d2;
d1.swap(d2);//交换两个空间元素
} //大小操作
void test03() {
deque<int> d1;
if (d1.empty()) {
cout << "为空!" << endl;
}
cout<<d1.size(); d1.resize(); }
//deque 插入删除
void test04() {
deque<int> d1;
d1.push_back();
d1.push_front();
d1.push_back();
d1.push_front();
d1.pop_back();
d1.pop_front();
printDeque(d1); if (int val = d1.front() == ) {//判断完 没问题就进行删除
d1.pop_front();
} } int main() { }

STL 小白学习(4) deque的更多相关文章

  1. STL 小白学习(1) 初步认识

    #include <iostream> using namespace std; #include <vector> //动态数组 #include <algorithm ...

  2. C++ STL 源代码学习(之deque篇)

    stl_deque.h /** Class invariants: * For any nonsingular iterator i: * i.node is the address of an el ...

  3. STL 小白学习(10) map

    map的构造函数 map<int, string> mapS; 数据的插入:用insert函数插入pair数据,下面举例说明 mapStudent.insert(pair<, &qu ...

  4. STL 小白学习(9) 对组

    void test01() { //构造方法 pair<, ); cout << p1.first << p1.second << endl; pair< ...

  5. STL 小白学习(8) set 二叉树

    #include <iostream> using namespace std; #include <set> void printSet(set<int> s) ...

  6. STL 小白学习(7) list

    #include <iostream> using namespace std; #include <list> void printList(list<int>& ...

  7. STL 小白学习(5) stack栈

    #include <iostream> #include <stack> //stack 不遍历 不支持随机访问 必须pop出去 才能进行访问 using namespace ...

  8. STL 小白学习(6) queue

    //queue 一端插入 另一端删除 //不能遍历(不提供迭代器) 不支持随机访问 #include <queue> #include <iostream> using nam ...

  9. STL 小白学习(3) vector

    #include <iostream> using namespace std; #include <vector> void printVector(vector<in ...

随机推荐

  1. java框架之SpringBoot(14)-任务

    使用 maven 创建 SpringBoot 项目,引入 Web 场景启动器. 异步任务 1.编写异步服务类,注册到 IoC 容器: package zze.springboot.task.servi ...

  2. 基于Spark Streaming + Canal + Kafka对Mysql增量数据实时进行监测分析

    Spark Streaming可以用于实时流项目的开发,实时流项目的数据源除了可以来源于日志.文件.网络端口等,常常也有这种需求,那就是实时分析处理MySQL中的增量数据.面对这种需求当然我们可以通过 ...

  3. linux查看cpu个数,线程数及cpu型号

    1.查看CPU逻辑id grep 'physical id' /proc/cpuinfo | sort -u physical id : 0physical id : 1 2.查看物理CPU个数 $ ...

  4. pytorch预训练模型的下载地址以及解决下载速度慢的方法

    https://github.com/pytorch/vision/tree/master/torchvision/models 几乎所有的常用预训练模型都在这里面 总结下各种模型的下载地址: 1 R ...

  5. Sigleton bj

    package com.bjsxt.base; class Sigleton{ private Sigleton(){}; private static Sigleton instance = new ...

  6. sqlite数据库中为字段设置默认值为当前时间

    开始 `creation_time` NUMERIC DEFAULT (datetime('now','localtime')), `update_time` NUMERIC DEFAULT (dat ...

  7. Eclipse启动报错An internal error occurred during: "Initializing Java Tooling"

    Eclipse启动报错An internal error occurred during: "Initializing Java Tooling" 解决方案: 删除工作空间work ...

  8. 第九篇——Struts2的拦截器

    拦截器: Struts2大多数核心功能都是通过拦截器实现的,每个拦截器完成某项功能: 拦截器方法在Action执行之前或之后执行. 工作原理: 拦截器的执行过程是一个递归的过程 action请求--& ...

  9. oracel数据库主键自增

    -- Create sequence create sequence FILE_ID_SEQ   主键名(自增列) minvalue 1         起始 maxvalue 99999     最 ...

  10. Python类的私有属性

    class Bar(object): __age = 18 sex = 'male' def __init__(self, ): pass def f(self): print(self.__age) ...