当前位置:网站首页>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 ).
边栏推荐
- 一改测试步骤代码就全写 为什么不试试用 Yaml实现数据驱动?
- Basic usage of xargs command
- go-redis之初始化连接
- 甘肃旅游产品预订增四倍:“绿马”走红,甘肃博物馆周边民宿一房难求
- 数学建模2004B题(输电问题)
- Redis之Geospatial
- Pytest参数化你不知道的一些使用技巧 /你不知道的pytest
- Advanced Computer Network Review(4)——Congestion Control of MPTCP
- CUDA implementation of self defined convolution attention operator
- Reids之缓存预热、雪崩、穿透
猜你喜欢
![[oc]- < getting started with UI> -- learning common controls](/img/2c/d317166e90e1efb142b11d4ed9acb7.png)
[oc]- < getting started with UI> -- learning common controls

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

LeetCode:221. Largest Square

Redis之哨兵模式

QML type: locale, date

Redis之连接redis服务命令

Booking of tourism products in Gansu quadrupled: "green horse" became popular, and one room of B & B around Gansu museum was hard to find

Compétences en mémoire des graphiques UML

Advanced Computer Network Review(5)——COPE

LeetCode:124. Maximum path sum in binary tree
随机推荐
Advanced Computer Network Review(4)——Congestion Control of MPTCP
Redis之cluster集群
注意力机制的一种卷积替代方式
甘肃旅游产品预订增四倍:“绿马”走红,甘肃博物馆周边民宿一房难求
LeetCode:214. Shortest palindrome string
Digital people anchor 618 sign language with goods, convenient for 27.8 million people with hearing impairment
Leetcode刷题题解2.1.1
QML control type: menu
Simclr: comparative learning in NLP
LeetCode:124. Maximum path sum in binary tree
MySQL uninstallation and installation methods
[oc]- < getting started with UI> -- learning common controls
Selenium+pytest automated test framework practice
[daily question] Porter (DFS / DP)
Alibaba cloud server mining virus solution (practiced)
BN折叠及其量化
Go redis initialization connection
Leetcode: Jianzhi offer 03 Duplicate numbers in array
【shell脚本】使用菜单命令构建在集群内创建文件夹的脚本
SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date