This action will force synchronization from secondtonone1/cpplearn, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
#include "../inc/rightrf.h"#include <utility>#include <iostream>using namespace std;void right_references_1(){int i = 42;//r 为i的引用,左值引用int &r = i;//rr 不可以引用左值i,//因为其是右值引用//int &&rr = i;//表达式是一个右值//不能用左值引用//int &r2 = i*42;//可以将const引用绑定到右值上const int &r3 = i * 42;//将rr2绑定到乘法结果上int &&rr2 = i * 42;}void right_references_2(){//右值引用捕获字面常量值int &&rr1 = 42;//右值引用不能捕获左值//因为rr1为左值,下面操作非法//int &&rr2 = rr1;}void right_references(){//右值引用捕获字面常量值int &&rr1 = 42;//通过move将左值转化为右值引用int &&rr3 = std::move(rr1);}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。