Skip to content

Commit 1db84fe

Browse files
book, code: fix typos (#225)
1 parent 847b536 commit 1db84fe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

book/zh-cn/03-runtime.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void foo() {
333333
```
334334
335335
由于 `int&` 不能引用 `double` 类型的参数,因此必须产生一个临时值来保存 `s` 的值,
336-
从而当 `increase()` 修改这个临时值时,从而调用完成后 `s` 本身并没有被修改。
336+
从而当 `increase()` 修改这个临时值时,调用完成后 `s` 本身并没有被修改。
337337
338338
第二个问题,为什么常量引用允许绑定到非左值?原因很简单,因为 Fortran 需要。
339339

code/3/3.3.rvalue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void reference(std::string&& str) {
2020
int main()
2121
{
2222
std::string lv1 = "string,"; // lv1 is a lvalue
23-
// std::string&& r1 = s1; // illegal, rvalue can't ref to lvalue
23+
// std::string&& r1 = lv1; // illegal, rvalue can't ref to lvalue
2424
std::string&& rv1 = std::move(lv1); // legal, std::move can convert lvalue to rvalue
2525
std::cout << rv1 << std::endl; // string,
2626

0 commit comments

Comments
 (0)