当前位置:网站首页>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 ).
边栏推荐
- LeetCode:41. Missing first positive number
- pytorch查看张量占用内存大小
- LeetCode:剑指 Offer 04. 二维数组中的查找
- View computer devices in LAN
- Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)
- How to effectively conduct automated testing?
- ESP8266-RTOS物联网开发
- hutool优雅解析URL链接并获取参数
- Using C language to complete a simple calculator (function pointer array and callback function)
- [sword finger offer] serialized binary tree
猜你喜欢
广州推进儿童友好城市建设,将探索学校周边200米设安全区域
Sublime text in CONDA environment plt Show cannot pop up the problem of displaying pictures
Chapter 1 :Application of Artificial intelligence in Drug Design:Opportunity and Challenges
704 binary search
Computer cleaning, deleted system files
vb. Net changes with the window, scales the size of the control and maintains its relative position
LeetCode:236. The nearest common ancestor of binary tree
Unsupported operation exception
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
UML图记忆技巧
随机推荐
LeetCode:498. 对角线遍历
poi追加写EXCEL文件
Export IEEE document format using latex
多元聚类分析
Leetcode: Jianzhi offer 03 Duplicate numbers in array
swagger设置字段required必填
Light of domestic games destroyed by cracking
Deep anatomy of C language -- C language keywords
LeetCode:236. 二叉树的最近公共祖先
UML圖記憶技巧
The network model established by torch is displayed by torch viz
C语言深度解剖——C语言关键字
Shift Operators
Leetcode: Sword Finger offer 42. Somme maximale des sous - tableaux consécutifs
LeetCode:劍指 Offer 42. 連續子數組的最大和
[NVIDIA development board] FAQ (updated from time to time)
UML图记忆技巧
Hutool gracefully parses URL links and obtains parameters
How to conduct interface test? What are the precautions? Nanny level interpretation
[sword finger offer] serialized binary tree