book: typo fixes (#249)

This commit is contained in:
stephen9357
2022-09-09 02:20:43 +08:00
committed by GitHub
parent 237c990510
commit 8182184f2a
2 changed files with 2 additions and 2 deletions

View File

@@ -222,7 +222,7 @@ int main() {
In the above code, we can see that the `itr` variable is defined in the scope of
the entire `main()`, which causes us to rename the other when a variable need to traverse
the entire `std::vectors` again. C++17 eliminates this limitation so that
the entire `std::vector` again. C++17 eliminates this limitation so that
we can do this in if(or switch):
```cpp

View File

@@ -182,7 +182,7 @@ int main() {
}
```
在上面的代码中,我们可以看到 `itr` 这一变量是定义在整个 `main()` 的作用域内的,这导致当我们需要再次遍历整个 `std::vectors`需要重新命名另一个变量。C++17 消除了这一限制,使得我们可以在 `if`(或 `switch`)中完成这一操作:
在上面的代码中,我们可以看到 `itr` 这一变量是定义在整个 `main()` 的作用域内的,这导致当我们需要再次遍历整个 `std::vector`需要重新命名另一个变量。C++17 消除了这一限制,使得我们可以在 `if`(或 `switch`)中完成这一操作:
```cpp
// 将临时变量放到 if 语句内