#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. SpringBoot系列教程web篇Servlet 注册的四种姿势

    原文: 191122-SpringBoot系列教程web篇Servlet 注册的四种姿势 前面介绍了 java web 三要素中 filter 的使用指南与常见的易错事项,接下来我们来看一下 Serv ...

  2. html5 audio标签微信部分苹果手机不能自动播放音乐终极解决方案

    html5 audio标签微信部分苹果手机不能自动播放音乐终极解决方案 大家都知道需要在点击时候后 播放 ps:如果点击ajax 回来播放也不行,必须点击立即播放 要背景自动播放只能采取下面方案< ...

  3. 新添加的用户无法sudo解决方案

    问题:xxx(用户名) is not in the sudoers file. This incident will be reported. 用户管理: 1.创建用户 (1)方法1 $ sudo a ...

  4. Win 10 没有 Hyper-V 解决方案

    1.首先新建一个记事本文件. 2.在记事本中写入. pushd "%~dp0" dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.m ...

  5. golang socket与Linux socket比较分析

    在posix标准推出后,socket在各大主流OS平台上都得到了很好的支持.而Golang是自带runtime的跨平台编程语言,Go中提供给开发者的socket API是建立在操作系统原生socket ...

  6. jboss/wildfly安全域的密码加密和解密

    加密: java_path=$(source /opt/wildfly/bin/.Beta1.jar:/opt/wildfly/modules/system/layers/base/org/jboss ...

  7. Angular的Observable可观察对象(转)

    原文:https://blog.csdn.net/qq_34414916/article/details/85194098 Observable 在开始讲服务之前,我们先来看一下一个新东西——Obse ...

  8. LOJ2257 SNOI2017 遗失的答案 容斥、高维前缀和

    传送门 数字最小公倍数为\(L\)的充分条件是所有数都是\(L\)的约数,而\(10^8\)内最多约数的数的约数也只有\(768\)个.所以我们先暴力找到所有满足是\(L\)的约数.\(G\)的倍数的 ...

  9. 【题解】Editor [HDU4699]

    [题解]Editor [HDU4699] 传送: \(Editor\) \([HDU4699]\) [题目描述] 有一个维护整数序列的强大编辑器,初始状态为空,下面提供五种不同的操作,给出的总操作次数 ...

  10. Python 中拼音库 PyPinyin 的用法【华为云技术分享】

    [摘要] 最近碰到了一个问题,项目中很多文件都是接手过来的中文命名的一些素材,结果在部署的时候文件名全都乱码了,导致项目无法正常运行. 后来请教了一位大佬怎么解决文件名乱码的问题,他说这个需要正面解决 ...