#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. BST平衡二叉树的后继结点(最近的大)

    public class InorderSuccessorInBST {//平衡二叉树查找后继结点 public TreeNode inorderSuccessor(TreeNode root, Tr ...

  2. 【linux】查看jar里面的配置文件

    1.vim 文件.jar 2.光标到配置文件,然后回车 3.退出命令:q 也可以进行编辑,按i进入编辑,按:wq保存退出

  3. protobuf, python Enum

    继承enum.Enum的python class,其实是一个, name-value的关系,可以直接className(value)得到一个类.比如 import enum class xx(enum ...

  4. TYPORA语法

    原文链接:https://blog.csdn.net/SIMBA1949/article/details/79001226

  5. TP5 按照汉字的拼音排序

    业务需求:接口返回一个列表,但是这个列表要求按一定的条件排序,条件如下: 1,某字段(field1)为null的排前面 2,某字段(field2)为null的排前面 3,姓名(field3)按照汉字的 ...

  6. 如何申请腾讯地图用户Key

    打开网页https://lbs.qq.com/,进入腾讯位置服务. 单击[登录],登录腾讯账号(本文以QQ登录为例),如果首次登陆腾讯位置服务,则提示注册开发者账号. 选择箭头处[注册新账号].填写手 ...

  7. FPGA 软件平台

    FPGA软件平台 系统 --> windows 7 xilinx --> vivado 2016.4 xilinx --> ISE 14.7 Altera --> quartu ...

  8. Python批量更改文件名

    一.问题在处理文件或者一些其他信息的时候我们需要更改文件名,那么我们可以写一个程序来修改这些文件名,以减少我们重复的做一件事. 二.解决本次使用的Python,利用的是Python中的OS模块,具体操 ...

  9. laravel hash密码生成和密码验证

    在laravel中 登录表单中的密码是用hash来生成的. 在生成密码需要用到 laravel框架中的方法(都是laravel封装好了的) bcrypt($password)方法,直接将获取到的pas ...

  10. easydict的使用方法

    easydict的作用:可以使得以属性的方式去访问字典的值 from easydict import EasyDict as edict a=['8',2,3]a=edict()a.f=99print ...