当前位置:网站首页>What is an R-value reference and what is the difference between it and an l-value?
What is an R-value reference and what is the difference between it and an l-value?
2022-07-06 09:14:00 【it_ xiangqiang】
Right value reference and left value
- The role of R-value reference
- The concepts of left and right values
- The difference between right and left references
The role of R-value reference
The right quotation is C++11 New features introduced in , It implements transfer semantics and precise delivery . Its main
The purpose has two aspects :
- Eliminate unnecessary copy of objects when two objects interact , Save computing and storage resources , Increase of efficiency .
- Can be more concise and clear definition of generic functions .
The concepts of left and right values
The left value : Can take address for expression 、 Or named objects / Variable . A persistent object that still exists after the end of an expression .
Right value : Cannot address an expression , Or anonymous objects . A temporary object that no longer exists at the end of an expression .
The difference between right and left references
- Left values can address , And right value can't .
- Left values can be assigned , Right values cannot be assigned , It can be used to assign values to left values .
- Left variable , The right value is immutable ( For foundation types only , The right value reference of user-defined type can be through member function
change ).
边栏推荐
- CUDA realizes focal_ loss
- Intel distiller Toolkit - Quantitative implementation 1
- [OC]-<UI入门>--常用控件-UIButton
- Redis之Geospatial
- Post training quantification of bminf
- 【shell脚本】——归档文件脚本
- Advanced Computer Network Review(4)——Congestion Control of MPTCP
- LeetCode:214. Shortest palindrome string
- Selenium+Pytest自动化测试框架实战(下)
- Leetcode刷题题解2.1.1
猜你喜欢

Redis之主从复制

Simclr: comparative learning in NLP

LeetCode41——First Missing Positive——hashing in place & swap

Advanced Computer Network Review(5)——COPE
![[OC-Foundation框架]-<字符串And日期与时间>](/img/75/e20064fd0066810135771a01f54360.png)
[OC-Foundation框架]-<字符串And日期与时间>

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
![[sword finger offer] serialized binary tree](/img/e2/25c9322da3acda06c4517b0c50f81e.png)
[sword finger offer] serialized binary tree

Selenium+Pytest自动化测试框架实战

LeetCode:124. Maximum path sum in binary tree

I-BERT
随机推荐
LeetCode:39. Combined sum
LeetCode:394. String decoding
[OC-Foundation框架]-<字符串And日期与时间>
Parameterization of postman
Reids之缓存预热、雪崩、穿透
Using label template to solve the problem of malicious input by users
LeetCode:162. Looking for peak
【文本生成】论文合集推荐丨 斯坦福研究者引入时间控制方法 长文本生成更流畅
After reading the programmer's story, I can't help covering my chest...
Redis之核心配置
[MySQL] multi table query
Pytorch view tensor memory size
Once you change the test steps, write all the code. Why not try yaml to realize data-driven?
[OC foundation framework] - string and date and time >
Selenium+pytest automated test framework practice (Part 2)
Redis之持久化实操(Linux版)
Master slave replication of redis
Compétences en mémoire des graphiques UML
BN折叠及其量化
Advanced Computer Network Review(3)——BBR