#include<vector>
#include<iostream>
using namespace std; void main()
{
vector<int> vInt;
vInt.push_back();
vInt.push_back();
vInt.push_back();
vInt.push_back();
vInt.push_back(); vector<int>::iterator it=vInt.begin();
for (;it!=vInt.end();it++)
{
cout<<*it<<" ";
}
cout<<endl; vector<int>::reverse_iterator rit=vInt.rbegin();
for (;rit!=vInt.rend();rit++)
{
cout<<*rit<<" ";
}
cout<<endl; it=vInt.end();
for (--it;it!=vInt.begin();--it)
{
cout<<*it<<" ";
}
cout<<*it<<" ";
cout<<endl; if (*(vInt.rbegin())==*(vInt.end()-))
{
cout<<"rbegin()== end()-1"<<endl;
}
else
{
cout<<"rbegin()!=end()"<<endl;
}
if (*(vInt.rend()-)==*(vInt.begin()))
{
cout<<"rend()-1 ==begin()"<<endl;
}
else
{
cout<<"rend()!=begin()"<<endl;
} } // 1 2 3 4 5
// 5 4 3 2 1
// 5 4 3 2 1
// rbegin()== end()-1
// rend()-1 ==begin()
// Press any key to continue

vector rIterator的更多相关文章

  1. c++ vector 使用

    1. 包含一个头文件: 1 #include <vector> 2. 申明及初始化: std::vector<int> first; // empty vector of in ...

  2. Vector Tile

    Mapbox Vector Tile Specification A specification for encoding tiled vector data. <?XML:NAMESPACE ...

  3. ArrayList、Vector、LinkedList的区别联系?

    1.ArrayList.Vector.LinkedList类都是java.util包中,均为可伸缩数组. 2.ArrayList和Vector底层都是数组实现的,所以,索引数据快,删除.插入数据慢. ...

  4. ArrayList、Vector、HashMap、HashSet的默认初始容量、加载因子、扩容增量

    当底层实现涉及到扩容时,容器或重新分配一段更大的连续内存(如果是离散分配则不需要重新分配,离散分配都是插入新元素时动态分配内存),要将容器原来的数据全部复制到新的内存上,这无疑使效率大大降低. 加载因 ...

  5. Java中Vector和ArrayList的区别

    首先看这两类都实现List接口,而List接口一共有三个实现类,分别是ArrayList.Vector和LinkedList.List用于存放多个元素,能够维护元素的次序,并且允许元素的重复.3个具体 ...

  6. C++使用vector

    #include <iostream> #include <string> #include <vector> using namespace std; void ...

  7. [LeetCode] Flatten 2D Vector 压平二维向量

    Implement an iterator to flatten a 2d vector. For example,Given 2d vector = [ [1,2], [3], [4,5,6] ] ...

  8. C++ 数组array与vector的比较

    转:http://blog.csdn.net/yukin_xue/article/details/7391897 1. array 定义的时候必须定义数组的元素个数;而vector 不需要: 且只能包 ...

  9. vector定义初始化

    头文件 #include<vector> using std::vector; vector<T> v1; vector<T> v2(v1); vector< ...

随机推荐

  1. 理解Spring中的IoC和DI

    什么是IoC和DI IoC(Inversion of Control 控制反转):是一种面向对象编程中的一种设计原则,用来减低计算机代码之间的耦合度.其基本思想是:借助于"第三方" ...

  2. JVM常用命令和性能调优建议 [Could not create the Java virtual machine]

    一.查看jvm常用命令jinfo:可以输出并修改运行时的java 进程的opts. jps:与unix上的ps类似,用来显示本地的java进程,可以查看本地运行着几个java程序,并显示他们的进程号. ...

  3. JSR223 PostProcessor VS BeanShell PostProcessor in JMeter

    I would recommend using JSR223 PostProcessor About performance: In JMeter's official user manual, Ab ...

  4. ElasticSearch中碰到的C10K问题

    Elasticsearch基于Netty解决C10K问题背后的原理是JAVA NIO中的IO多路复用机制,涉及到三大"组件":SelectableChannel.Selector. ...

  5. vue-cli中跨域问题解决方法

    webpack提供了配置代理的方法解决跨域 1 在vue-cli项目中打开webpack.dev.cof.js,如下 2 打开conifg目录下的index.js,在 proxyTable中进行配置 ...

  6. k8s的学习

    20191123 开始重头再学一遍k8 一 K8S的组件介绍

  7. js组件

    最近学习了一下js组件相关知识,但找到的资料比较少,一知半解,先做个简单的笔记吧. 首先定义一个类,可以在里面添加方法: //这是个下拉框组件,放在select.js里 var tree = { tr ...

  8. 论文翻译:Data mining with big data

    原文: Wu X, Zhu X, Wu G Q, et al. Data mining with big data[J]. IEEE transactions on knowledge and dat ...

  9. 安装和使用pyltp

    什么是pyltp: pyltp 是LTP的 Python 封装,提供了分词,词性标注,命名实体识别,依存句法分析,语义角色标注的功能. 安装 pyltp 测试环境:系统win10 64位, pytho ...

  10. Java自学-类和对象 属性初始化

    如何进行Java的属性初始化 步骤 1 : 对象属性初始化 对象属性初始化有3种 声明该属性的时候初始化 构造方法中初始化 初始化块 . public class Hero { public Stri ...