当前位置:网站首页>For (Auto A: b) and for (Auto & A: b) usage
For (Auto A: b) and for (Auto & A: b) usage
2022-07-02 19:51:00 【My. Chicken with vegetables for scientific research】
The difference between the two usages
- for(auto a:b) in b For a container , The effect is to use a Traverse and get b Every value in the container , however a Can't affect b Elements in the container .
- for(auto &a:b) A reference symbol is added in the , You can assign values to the contents of the container , Through a Assignment to do container b Fill in the content of .
Test code
#include<iostream>
using namespace std;
int main()
{
int i[10]
边栏推荐
- AcWing 341. 最优贸易 题解 (最短路、dp)
- Detailed explanation of VBScript (I)
- AcWing 1126. Minimum cost solution (shortest path Dijkstra)
- 定了,就是它!
- KT148A语音芯片ic的硬件设计注意事项
- After writing 100000 lines of code, I sent a long article roast rust
- pxe装机「建议收藏」
- Infix expression is converted to suffix expression (C language code + detailed explanation)
- 从20s优化到500ms,我用了这三招
- NMF-matlab
猜你喜欢
Idea editor removes SQL statement background color SQL statement warning no data sources are configured to run this SQL And SQL dialect is not config
SQLite 3.39.0 发布,支持右外连接和全外连接
Registration opportunity of autowiredannotationbeanpostprocessor in XML development mode
AcWing 903. 昂贵的聘礼 题解(最短路—建图、dijkstra)
KS004 基于SSH通讯录系统设计与实现
rxjs Observable 自定义 Operator 的开发技巧
定了,就是它!
Detailed tutorial on installing stand-alone redis
MySQL function
sql-labs
随机推荐
Istio1.12: installation and quick start
Zabbix5 client installation and configuration
c语言里怎么设立优先级,细说C语言优先级
Istio部署:快速上手微服务,
for(auto a : b)和for(auto &a : b)用法
AcWing 343. Sorting problem solution (Floyd property realizes transitive closure)
AcWing 1131. 拯救大兵瑞恩 题解(最短路)
One side is volume, the other side is layoff. There are a lot of layoffs in byte commercialization department. What do you think of this wave?
AcWing 1131. Saving Private Ryan (the shortest way)
Design and implementation of ks004 based on SSH address book system
c语言链表--待补充
Introduction to mongodb chapter 03 basic concepts of mongodb
自動生成VGG圖像注釋文件
蓝牙芯片ble是什么,以及该如何选型,后续技术发展的路径是什么
简书自动阅读
Chapter 7 - class foundation
ShardingSphere-JDBC5.1.2版本关于SELECT LAST_INSERT_ID()本人发现还是存在路由问题
Kt148a voice chip instructions, hardware, protocols, common problems, and reference codes
GCC: Graph Contrastive Coding for Graph Neural NetworkPre-Training
Motivation! Big Liangshan boy a remporté le prix Zhibo! Un article de remerciement pour les internautes qui pleurent