当前位置:网站首页>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 ).
边栏推荐
- ESP8266-RTOS物联网开发
- LeetCode:394. 字符串解码
- TP-LINK 企业路由器 PPTP 配置
- LeetCode:劍指 Offer 42. 連續子數組的最大和
- Generator parameters incoming parameters
- Marathon envs project environment configuration (strengthen learning and imitate reference actions)
- Leetcode刷题题解2.1.1
- LeetCode:236. 二叉树的最近公共祖先
- Using pkgbuild:: find in R language_ Rtools check whether rtools is available and use sys The which function checks whether make exists, installs it if not, and binds R and rtools with the writelines
- 有效提高软件产品质量,就找第三方软件测评机构
猜你喜欢
[OC-Foundation框架]---【集合数组】
LeetCode:221. Largest Square
Double pointeur en langage C - - modèle classique
企微服务商平台收费接口对接教程
Screenshot in win10 system, win+prtsc save location
广州推进儿童友好城市建设,将探索学校周边200米设安全区域
Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)
Swagger setting field required is mandatory
Problems encountered in connecting the database of the project and their solutions
目标检测——Pytorch 利用mobilenet系列(v1,v2,v3)搭建yolov4目标检测平台
随机推荐
Tcp/ip protocol
Double pointeur en langage C - - modèle classique
[embedded] print log using JLINK RTT
swagger设置字段required必填
Revit secondary development Hof method calls transaction
LeetCode:剑指 Offer 48. 最长不含重复字符的子字符串
ant-design的走马灯(Carousel)组件在TS(typescript)环境中调用prev以及next方法
Mobile phones and computers on the same LAN access each other, IIS settings
Hutool gracefully parses URL links and obtains parameters
Niuke winter vacation training 6 maze 2
Navicat Premium 创建MySql 创建存储过程
CSP first week of question brushing
Deep analysis of C language pointer
pytorch查看张量占用内存大小
Generator parameters incoming parameters
Unsupported operation exception
【嵌入式】使用JLINK RTT打印log
How to effectively conduct automated testing?
LeetCode:394. String decoding
有效提高软件产品质量,就找第三方软件测评机构