当前位置:网站首页>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 ).
边栏推荐
- Hutool gracefully parses URL links and obtains parameters
- Deep analysis of C language data storage in memory
- 有效提高软件产品质量,就找第三方软件测评机构
- Image, CV2 read the conversion and size resize change of numpy array of pictures
- Computer graduation design PHP Zhiduo online learning platform
- Shift Operators
- LeetCode:394. 字符串解码
- Notes 01
- Indentation of tabs and spaces when writing programs for sublime text
- LeetCode:34. 在排序数组中查找元素的第一个和最后一个位置
猜你喜欢
[embedded] print log using JLINK RTT
Current situation and trend of character animation
项目连接数据库遇到的问题及解决
广州推进儿童友好城市建设,将探索学校周边200米设安全区域
PC easy to use essential software (used)
Computer graduation design PHP Zhiduo online learning platform
Variable length parameter
[OC-Foundation框架]---【集合数组】
企微服务商平台收费接口对接教程
【ROS】usb_ Cam camera calibration
随机推荐
Li Kou daily question 1 (2)
Warning in install. packages : package ‘RGtk2’ is not available for this version of R
Leetcode: Sword finger offer 42 Maximum sum of continuous subarrays
Problems in loading and saving pytorch trained models
SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date
To effectively improve the quality of software products, find a third-party software evaluation organization
CSP first week of question brushing
LeetCode:124. 二叉树中的最大路径和
After PCD is converted to ply, it cannot be opened in meshlab, prompting error details: ignored EOF
ROS compilation calls the third-party dynamic library (xxx.so)
UnsupportedOperationException异常
opencv+dlib实现给蒙娜丽莎“配”眼镜
Leetcode: Sword finger offer 48 The longest substring without repeated characters
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
Image, CV2 read the conversion and size resize change of numpy array of pictures
Revit 二次开发 HOF 方式调用transaction
[OC-Foundation框架]-<字符串And日期与时间>
LeetCode:39. Combined sum
LeetCode:394. String decoding
多元聚类分析