Skip to content

Commit edb8470

Browse files
ibyte2011changkun
authored andcommitted
fix: comments (changkun#53)
引用的右值-->常量引用
1 parent 6c59f01 commit edb8470

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

book/zh-cn/03-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ int main()
241241
std::cout << rv1 << std::endl; // string,
242242

243243
const std::string& lv2 = lv1 + lv1; // 合法, 常量左值引用能够延长临时变量的生命周期
244-
// lv2 += "Test"; // 非法, 引用的右值无法被修改
244+
// lv2 += "Test"; // 非法, 常量引用无法被修改
245245
std::cout << lv2 << std::endl; // string,string
246246

247247
std::string&& rv2 = lv1 + lv2; // 合法, 右值引用延长临时对象生命周期

0 commit comments

Comments
 (0)