#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. mongodb compass 启动报错()

    报错: 原因:由于直接关闭客户端,进程没关导致下次开启时,后台还是运行的所以无法重新开启 解决办法: 1.查看进程 tasklist | findstr “MongoDBCompass.exe” 2. ...

  2. vue.js与element-ui实现菜单树形结构

    由于业务需要,要求实现树形菜单,且菜单数据由后台返回,在网上找了几篇文章,看下来总算有了解决办法.借鉴文章链接在最底部. 场景:根据业务要求,需要实现活动的树形菜单,菜单数据由后台返回,最后的效果图如 ...

  3. [转帖]在 Kubernetes 离线部署 KubeSphere

    在 Kubernetes 离线部署 KubeSphere https://kubesphere.io/docs/v2.0/zh-CN/installation/install-ks-offline/ ...

  4. Java核心技术-读书笔记

    基本语法 Java中的所有函数都属于某个类的方法 Java没有任何无符号的int.long.short 或 byte 类型 浮点数值不适用于无法接受舍入误差的金融计算中,比如2.0-1.1不会输出想要 ...

  5. 如何选择CPU

    一.品牌: 选择哪家公司的处理器,AMD公司和inter公司的处理器相比较,AMD在三维制作.游戏应用.和视频处理方面突出,inter的处理器在商业应用.多媒体应用.平面设计方面有优势,性能方面,同档 ...

  6. English--动名词

    English|动名词 开始动名词的学习,代表着在长难句的征途上又向前迈出了一步. 前言 目前所有的文章思想格式都是:知识+情感. 知识:对于所有的知识点的描述.力求不含任何的自我感情色彩. 情感:用 ...

  7. - Permission 运行时权限 总结 翻译 MD

    目录 目录 对运行时权限的一些理解 运行时权限使用案例 开源库:PermissionsDispatcher 注解 使用案例 使用步骤 测试代码 自动生成的类 官方文档:请求权限 Add permiss ...

  8. C# 创建json传输格式的http请求

    public static string PostRequestTest(string content, string url, string contentType = "applicat ...

  9. [Cocos Creator]安卓上微信小游戏加载到100%就进不去了

    最近用Cocos Creator 开发微信小游戏,构建发布到微信上,用安卓手机预览打开后加载到100%就不动了,开始以为微信开发工具版本的问题,后来用苹果的手机测试了一下,发现也有同样的问题. 仔细分 ...

  10. Spring Security 解析(五) —— Spring Security Oauth2 开发

    Spring Security 解析(五) -- Spring Security Oauth2 开发   在学习Spring Cloud 时,遇到了授权服务oauth 相关内容时,总是一知半解,因此决 ...