deque向量
2016-02-24 20:30
330 查看
#include <iostream> #include <deque> #include <algorithm> // 算法的头文件, int main() { using namespace std; deque<int> a; a.push_back(2); a.push_back(3); a.push_front(4); for (size_t nCount = 0; nCount < a.size(); ++nCount) { cout << a[nCount] << endl; } cout << endl; a.pop_front(); // 将4删除, a.pop_back(); // 将3删除 deque<int>::iterator iElementLocater; //iElementLocater是deque自己的迭代器, for(iElementLocater = a.begin(); iElementLocater != a.endl(); ++iElementLocater) { size_t nOffset = distance(a.begin(),iElementLocater); // distance是a.begin()和iElementLocater两个迭代器之间的距离, cout << "a[" << nOffset << "] = " << *iElementLocater << endl; } return 0; }
相关文章推荐
- UITextField知多少
- 持续集成(CI)-build, test, and deploy & 自动化编译系统 mark & learn
- Android--UI控件的使用格式化
- iOS 开发之动画篇 - 从 UIView 动画说起
- 深入分析Parquet列式存储格式
- POJ - 3481 Double Queue
- hasshmap输出value
- ios隐藏UItableview下面多余的tableview的线条CELL / 隐藏脚视图
- @RequestParam 和@RequestBody的使用方式
- UITextView 监听 return key的改变
- LeetCode Algorithms #232 <Implement Queue using Stacks>
- 放肆地使用UIBezierPath和CAShapeLayer画各种图形
- APUE.3e 安装 Ubuntu
- UITextField 小总结
- 1099. Build A Binary Search Tree (30)
- UINT8_T / UINT16_T / UINT32_T /UINT64_T讲解
- 机器人操作系统(ROS)教程19:安装ARDUINO IDE使用rosserial
- UI整理-----part8--导航控制器(navigationController)
- UIFont字体大全
- 【Mac上的问题】ValueError: unknown locale: UTF-8