当前位置:网站首页>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 ).
边栏推荐
- I-BERT
- Notes 01
- Selenium+Pytest自动化测试框架实战
- Kratos ares microservice framework (I)
- Leetcode: Jianzhi offer 03 Duplicate numbers in array
- Chapter 1 :Application of Artificial intelligence in Drug Design:Opportunity and Challenges
- Show slave status \ read in G_ Master_ Log_ POS and relay_ Log_ The (size) relationship of POS
- Different data-driven code executes the same test scenario
- [oc]- < getting started with UI> -- common controls - prompt dialog box and wait for the prompt (circle)
- I-BERT
猜你喜欢

Le modèle sentinelle de redis

Advanced Computer Network Review(5)——COPE

LeetCode:221. Largest Square
![[sword finger offer] serialized binary tree](/img/e2/25c9322da3acda06c4517b0c50f81e.png)
[sword finger offer] serialized binary tree

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

Once you change the test steps, write all the code. Why not try yaml to realize data-driven?

Nacos 的安装与服务的注册

Improved deep embedded clustering with local structure preservation (Idec)

Redis之哨兵模式

Intel distiller Toolkit - Quantitative implementation 2
随机推荐
[today in history] February 13: the father of transistors was born The 20th anniversary of net; Agile software development manifesto was born
Redis之Bitmap
LeetCode41——First Missing Positive——hashing in place & swap
BN折叠及其量化
Intel distiller Toolkit - Quantitative implementation 3
Pytest之收集用例规则与运行指定用例
什么是MySQL?MySql的学习之路是怎样的
Using label template to solve the problem of malicious input by users
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
Problems encountered in connecting the database of the project and their solutions
BMINF的后训练量化实现
QML type: overlay
Reids之删除策略
Redis cluster
Digital people anchor 618 sign language with goods, convenient for 27.8 million people with hearing impairment
[OC]-<UI入门>--常用控件-UIButton
Leetcode problem solving 2.1.1
After reading the programmer's story, I can't help covering my chest...
UML圖記憶技巧