mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-16 20:27:08 +03:00
book: typo fixes (#249)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -182,7 +182,7 @@ int main() {
|
||||
}
|
||||
```
|
||||
|
||||
在上面的代码中,我们可以看到 `itr` 这一变量是定义在整个 `main()` 的作用域内的,这导致当我们需要再次遍历整个 `std::vectors` 时,需要重新命名另一个变量。C++17 消除了这一限制,使得我们可以在 `if`(或 `switch`)中完成这一操作:
|
||||
在上面的代码中,我们可以看到 `itr` 这一变量是定义在整个 `main()` 的作用域内的,这导致当我们需要再次遍历整个 `std::vector` 时,需要重新命名另一个变量。C++17 消除了这一限制,使得我们可以在 `if`(或 `switch`)中完成这一操作:
|
||||
|
||||
```cpp
|
||||
// 将临时变量放到 if 语句内
|
||||
|
||||
Reference in New Issue
Block a user