File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -345,7 +345,7 @@ int main()
345345
346346 const std::string& lv2 = lv1 + lv1; // legal, const lvalue reference can extend temp variable's lifecycle
347347 // lv2 += "Test"; // illegal, const ref can't be modified
348- std::cout << lv2 << std::endl; // string,string
348+ std::cout << lv2 << std::endl; // string,string,
349349
350350 std::string&& rv2 = lv1 + lv2; // legal, rvalue ref extend lifecycle
351351 rv2 += "string"; // legal, non-const reference can be modified
Original file line number Diff line number Diff line change @@ -293,7 +293,7 @@ int main()
293293
294294 const std::string& lv2 = lv1 + lv1; // 合法, 常量左值引用能够延长临时变量的生命周期
295295 // lv2 += "Test"; // 非法, 常量引用无法被修改
296- std::cout << lv2 << std::endl; // string,string
296+ std::cout << lv2 << std::endl; // string,string,
297297
298298 std::string&& rv2 = lv1 + lv2; // 合法, 右值引用延长临时对象生命周期
299299 rv2 += "Test"; // 合法, 非常量引用能够修改临时变量
You can’t perform that action at this time.
0 commit comments