c++11 右值引用

#include <bits/stdc++.h>
using namespace std;
string Get(){
	return string(200000000,'a');
}
int main(){
	int t=clock();
	const string &s0=Get();
	cerr<<clock()-t<<endl;
	t=clock();
	string s=Get();
	cerr<<clock()-t<<endl;
	t=clock();
	string &&ss=Get();
	cerr<<clock()-t<<endl;
	t=clock();
	string sss=move(s);
	//move: jiang you zuo zhi bian cheng you zhi bu fu zhi
	cerr<<clock()-t<<endl;
	t=clock();
	string &&ssss=move(ss);
	//move: jiang you zuo zhi bian cheng you zhi bu fu zhi
	cerr<<clock()-t<<endl;
}
posted @ 2019-03-27 21:05  Yuhuger  阅读(195)  评论(0编辑  收藏  举报