当前位置:网站首页>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 08:51:00 【it_ xiangqiang】
Right value reference and left value reference
- Right quoting
- The concepts of left and right values :
- The difference between right and left references :
Right quoting
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 ).
边栏推荐
- Crash problem of Chrome browser
- CSP first week of question brushing
- Trying to use is on a network resource that is unavailable
- 如何有效地进行自动化测试?
- [MySQL] limit implements paging
- Li Kou daily question 1 (2)
- 深度剖析C语言指针
- Sublime text using ctrl+b to run another program without closing other runs
- Navicat Premium 创建MySql 创建存储过程
- Notes 01
猜你喜欢

LeetCode:124. 二叉树中的最大路径和

Trying to use is on a network resource that is unavailable

Indentation of tabs and spaces when writing programs for sublime text

Problems in loading and saving pytorch trained models

Excellent software testers have these abilities

项目连接数据库遇到的问题及解决

数学建模2004B题(输电问题)

LeetCode:498. 对角线遍历

Tcp/ip protocol

Swagger setting field required is mandatory
随机推荐
@Jsonbackreference and @jsonmanagedreference (solve infinite recursion caused by bidirectional references in objects)
多元聚类分析
Mongodb installation and basic operation
To effectively improve the quality of software products, find a third-party software evaluation organization
Navicat premium create MySQL create stored procedure
704 binary search
CSP first week of question brushing
Marathon envs project environment configuration (strengthen learning and imitate reference actions)
项目连接数据库遇到的问题及解决
UML图记忆技巧
Navicat Premium 创建MySql 创建存储过程
【嵌入式】使用JLINK RTT打印log
UML diagram memory skills
[NVIDIA development board] FAQ (updated from time to time)
【嵌入式】Cortex M4F DSP库
[embedded] print log using JLINK RTT
[OC]-<UI入门>--常用控件-提示对话框 And 等待提示器(圈)
vb.net 随窗口改变,缩放控件大小以及保持相对位置
Sublime text in CONDA environment plt Show cannot pop up the problem of displaying pictures
TP-LINK 企业路由器 PPTP 配置