diff --git a/book/en-us/02-usability.md b/book/en-us/02-usability.md index 19eb4a30..12864e0d 100644 --- a/book/en-us/02-usability.md +++ b/book/en-us/02-usability.md @@ -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 diff --git a/book/zh-cn/02-usability.md b/book/zh-cn/02-usability.md index 5f0105b0..d7193dd4 100644 --- a/book/zh-cn/02-usability.md +++ b/book/zh-cn/02-usability.md @@ -182,7 +182,7 @@ int main() { } ``` -在上面的代码中,我们可以看到 `itr` 这一变量是定义在整个 `main()` 的作用域内的,这导致当我们需要再次遍历整个 `std::vectors` 时,需要重新命名另一个变量。C++17 消除了这一限制,使得我们可以在 `if`(或 `switch`)中完成这一操作: +在上面的代码中,我们可以看到 `itr` 这一变量是定义在整个 `main()` 的作用域内的,这导致当我们需要再次遍历整个 `std::vector` 时,需要重新命名另一个变量。C++17 消除了这一限制,使得我们可以在 `if`(或 `switch`)中完成这一操作: ```cpp // 将临时变量放到 if 语句内