博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
STL - 容器 - Deque
阅读量:6973 次
发布时间:2019-06-27

本文共 1090 字,大约阅读时间需要 3 分钟。

Deque和Vector类似,只不过deque头尾都开放,能够在头尾进行快速插入和删除操作

DequeTest.cpp

#include 
#include
#include
#include
#include
#include "DequeTest.h"using namespace std;void DequeTest::simpleOperation(){ // create empty deque of strings deque
coll; // insert several elements coll.assign(3, string("string")); coll.push_back("last string"); coll.push_front("first string"); // print elements separated by newlines copy(coll.cbegin(), coll.cend(), ostream_iterator
(cout, "\n")); cout << endl; // remove first and last element coll.pop_front(); coll.pop_back(); // insert "another" into every element but the first for (unsigned i = 1; i
(cout, "\n"));}void DequeTest::run(){ printStart("simpleOperation()"); simpleOperation(); printEnd("simpleOperation()");}

运行结果:

---------------- simpleOperation(): Run Start ----------------

first string
string
string
string
last string
string
another string
another string
resized string
---------------- simpleOperation(): Run End ----------------

 

转载地址:http://vlosl.baihongyu.com/

你可能感兴趣的文章
Custome Message in MVC3.0
查看>>
Cisco 单臂路由配置
查看>>
数据库缓存管理器块替换
查看>>
dedecms个人中心调用数据库数据问题
查看>>
Confluence 6 Windows 中以服务方式自动重启修改运行服务的用户
查看>>
kettle使用笔记(ETL篇)
查看>>
What's new in Red Hat Enterprise Linux 6.2
查看>>
MDaemonV15 版本新特性介绍
查看>>
我的友情链接
查看>>
typescript中的泛型
查看>>
安装Jenkins
查看>>
tab键技巧小结
查看>>
我的友情链接
查看>>
数据库管理中文件的使用
查看>>
centos7下查找项目路径
查看>>
我的友情链接
查看>>
TurboMail邮件系统无缝集成OA办公系统
查看>>
菜刀Access数据库去除密码小工具
查看>>
关于mqtt学习
查看>>
[转]使用System Center 2012 Unified Installer安裝微軟私有雲管理套件(RC)
查看>>