fix: typo (#49)

This commit is contained in:
ehds
2018-12-20 00:03:46 +08:00
committed by Ou Changkun
parent 2745fc33eb
commit 6f6531f40c

View File

@@ -236,7 +236,7 @@ void reference(std::string&& str) {
int main() int main()
{ {
std::string lv1 = "string,"; // lv1 是一个左值 std::string lv1 = "string,"; // lv1 是一个左值
// std::string&& r1 = s1; // 非法, 右值引用不能引用左值 // std::string&& r1 = lv1; // 非法, 右值引用不能引用左值
std::string&& rv1 = std::move(lv1); // 合法, std::move可以将左值转移为右值 std::string&& rv1 = std::move(lv1); // 合法, std::move可以将左值转移为右值
std::cout << rv1 << std::endl; // string, std::cout << rv1 << std::endl; // string,