当前位置:网站首页>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 ).
边栏推荐
猜你喜欢

Unsupported operation exception

UML diagram memory skills
![[embedded] cortex m4f DSP Library](/img/83/ab421d5cc18e907056ec2bdaeb7d5c.png)
[embedded] cortex m4f DSP Library

704 binary search

Delay initialization and sealing classes

ant-design的走马灯(Carousel)组件在TS(typescript)环境中调用prev以及next方法

角色动画(Character Animation)的现状与趋势

Generator parameters incoming parameters

Image, CV2 read the conversion and size resize change of numpy array of pictures

Deep anatomy of C language -- C language keywords
随机推荐
[MySQL] multi table query
Tdengine biweekly selection of community issues | phase III
深度剖析C语言指针
LeetCode:34. 在排序数组中查找元素的第一个和最后一个位置
Simple use of promise in uniapp
C语言深度解剖——C语言关键字
Alibaba cloud server mining virus solution (practiced)
poi追加写EXCEL文件
UML diagram memory skills
Navicat premium create MySQL create stored procedure
Niuke winter vacation training 6 maze 2
如何有效地进行自动化测试?
View computer devices in LAN
Cesium draw points, lines, and faces
Charging interface docking tutorial of enterprise and micro service provider platform
opencv+dlib实现给蒙娜丽莎“配”眼镜
C语言双指针——经典题型
如何正确截取字符串(例:应用报错信息截取入库操作)
Swagger setting field required is mandatory
[embedded] cortex m4f DSP Library