当前位置:网站首页>遍历vector容器中的对象的方式
遍历vector容器中的对象的方式
2022-06-29 08:49:00 【一大块肉松】
1.使用 auto进行遍历:for(auto i : v)
完整代码示例如下图
2、使用迭代器进行遍历iterator,使用该方法首先你需要先创建属于这个容器的迭代器,例如:vector::iterator
然后再使用循环对容器进行遍历。代码示例如下图所示:
上图代码中的vector::iterator it = v.begin() ,可以直接用auto it=v.begin() 来代替:原因是auto可以根据后面的值,来推测类型是什么。
边栏推荐
- Laravel 8 enables the order table to be divided by month level
- In the era of data processing, data quality construction is the way for enterprises to survive
- Wechat applet latest canvas2d handwritten signature
- UE4 动画重定向
- 数据可视化:数据可视化的意义
- ThinkPHP 6 uses mongodb
- 【技术开发】酒精测试仪解决方案开发设计
- 1.4 regression of machine learning methods
- Wechat applet opens file stream
- Data visualization: the four quadrants of data visualization teach you to correctly apply icons
猜你喜欢

MySQL configuring master-slave databases

Print service IP setting scheme

Wechat applet sub components transfer values to the page (communication between parent and child components) with source code

Simplicity Studio无法识别新买的JLink v9解决方法

Deep Learning-based Automated Delineation of Head and Neck Malignant Lesions from PET Images

UE4 在4.20-23版本安装Datasmith插件

UE4 在viewport视口中显示3D可编辑点

Matlab tips (21) matrix analysis -- partial least squares regression

UE4 去掉材质中Mask透明白边

SPI drive of lsm6dsl
随机推荐
Deep Learning-based Automated Delineation of Head and Neck Malignant Lesions from PET Images
长安链GO语言智能合约编写与编译
UE4 remove the mask transparent white edge in the material
通识篇:原型设计的认知,设计及最佳实践
GD32F4xx 以太网芯片(enc28j60)驱动移植
Pytoch Summary - transform between sensor and numpy
数据可视化:数据可视化的意义
Closed door cultivation (24) shallow understanding of cross domain problems
Matlab tips (21) matrix analysis -- partial least squares regression
Research progress of target detection in the era of deep convolutional neural network
UE4 蓝图修改Array 中Get a copy 为 reference
Data governance: Metadata Management (Part 2)
Iso16000-9 testing of volatile organic compounds in building products and furniture
Implementation of multi key state machine based on STM32 standard library
Redo after JS rotation view (longer full version, can be run)
基于stm32标准库独立按键的多按键状态机的实现
你知道BFD是什么吗?一文详解BFD协议原理及使用场景
After aikuai is installed or reset, the PC or mobile terminal cannot obtain IP
Wechat applet latest canvas2d handwritten signature
UE4 plug-in reports an error cannot open include file: 'modulemanager H 'resolve