move and rvalue

move

the move is a function to change a value to a type of rvalue.

rvalue reference

The value of variables with rvalue type are allowed to be modified using rvalue reference.
void p(int && a)
{
a=100;
}
int main()
{
p(100);
}

If you don't understand what happened, just print the address of a.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,151评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,457评论 0 23
  • 穷过,却没这么穷过,窘迫的喘不过气来,终于洋气了起来,学洋人刷信用生活,今天去刷了两万的信用。
    宁小静的日记阅读 1,241评论 0 0
  • 成功不能单靠聪明,还要靠一种百折不回的坚强!
    anMoo韩魔阅读 2,540评论 4 1
  • 今天练习的是打响舌。 还有一个绕口令,练完响舌再说绕口令还挺有力量感的。 持续8个8拍 丝音持续1分钟 喷音30...
    甜甜妈正面管教之路阅读 825评论 0 0