vector rIterator
#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的更多相关文章
- c++ vector 使用
1. 包含一个头文件: 1 #include <vector> 2. 申明及初始化: std::vector<int> first; // empty vector of in ...
- Vector Tile
Mapbox Vector Tile Specification A specification for encoding tiled vector data. <?XML:NAMESPACE ...
- ArrayList、Vector、LinkedList的区别联系?
1.ArrayList.Vector.LinkedList类都是java.util包中,均为可伸缩数组. 2.ArrayList和Vector底层都是数组实现的,所以,索引数据快,删除.插入数据慢. ...
- ArrayList、Vector、HashMap、HashSet的默认初始容量、加载因子、扩容增量
当底层实现涉及到扩容时,容器或重新分配一段更大的连续内存(如果是离散分配则不需要重新分配,离散分配都是插入新元素时动态分配内存),要将容器原来的数据全部复制到新的内存上,这无疑使效率大大降低. 加载因 ...
- Java中Vector和ArrayList的区别
首先看这两类都实现List接口,而List接口一共有三个实现类,分别是ArrayList.Vector和LinkedList.List用于存放多个元素,能够维护元素的次序,并且允许元素的重复.3个具体 ...
- C++使用vector
#include <iostream> #include <string> #include <vector> using namespace std; void ...
- [LeetCode] Flatten 2D Vector 压平二维向量
Implement an iterator to flatten a 2d vector. For example,Given 2d vector = [ [1,2], [3], [4,5,6] ] ...
- C++ 数组array与vector的比较
转:http://blog.csdn.net/yukin_xue/article/details/7391897 1. array 定义的时候必须定义数组的元素个数;而vector 不需要: 且只能包 ...
- vector定义初始化
头文件 #include<vector> using std::vector; vector<T> v1; vector<T> v2(v1); vector< ...
随机推荐
- 存储过程中的BeginEnd
存储过程中的BeginEnd和其它语言中的花括号,本身没有事务作用,主要有两个作用1.使语句结果清晰2.语句块作用,比如在 if 后面使用.
- SpringCloud 基础
目录 SpringCloud 基础 一.概述 二.服务发现组件 Eureka 1. 介绍 2. 搭建 Maven 父工程 3. 创建 Eureka 集群 4. 创建服务提供方集群 5. 创建服务消费方 ...
- bootstrap table--面相配置、hook、适配的表格框架
bootstrap table--面相配置.hook.适配的表格框架
- pandas mode()填充nan异常问题
df.mode()return的是一个frame,因为可能存在多个总数.那么用mode()来填充nan的时候就要注意了,如果直接 df.fillna(df.mode()) 会发现还是有很多空值没有填充 ...
- linux启动tomcat很久或者很慢Tomcat启动时卡在“INFO: Deploying web application directory ......”的解决方法
解决方案: 找到jdk1.x.x_xx/jre/lib/security/java.security文件,在文件中找到securerandom.source这个设置项,将其改为: securerand ...
- c# DataRow[]转Datatable
方法一: Datatable dt=new Datatable(); //添加列和数据(代码省略) DataRow[] drs = dt.Select("DeviceID='123'&quo ...
- kubernetes(k8s) Prometheus+grafana监控告警安装部署
主机数据收集 主机数据的采集是集群监控的基础:外部模块收集各个主机采集到的数据分析就能对整个集群完成监控和告警等功能.一般主机数据采集和对外提供数据使用cAdvisor 和node-exporter等 ...
- 一. jmeter
1.性能测试概述 1.1 主要方向是测试系统在一定负荷压力下,系统的响应时间,吞吐量,稳定性,系统的可扩展性等性能指标. 结合应用的架构和实现细节找出问题,并最终确认问题得到解决的过程. 目的: 1. ...
- 2019 中钢网java面试笔试题 (含面试题解析)
本人5年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.中钢网等公司offer,岗位是Java后端开发,因为发展原因最终选择去了中钢网,入职一年时间了,也成为了面试官 ...
- 【转载】使用宝塔Linux面板功能查看服务器CPU使用率
运维过阿里云服务器或者腾讯云服务器的运维人员都知道,针对耗资源以及高并发的应用,很多时候我们需要关注云服务器的资源利用率情况,如最近一段时间内CPU的使用率.内存占用率等情况信息.阿里云和腾讯云官方后 ...