File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ int main() {
222
222
223
223
In the above code, we can see that the ` itr ` variable is defined in the scope of
224
224
the entire ` main() ` , which causes us to rename the other when a variable need to traverse
225
- the entire ` std::vectors ` again. C++17 eliminates this limitation so that
225
+ the entire ` std::vector ` again. C++17 eliminates this limitation so that
226
226
we can do this in if(or switch):
227
227
228
228
``` cpp
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ int main() {
182
182
}
183
183
```
184
184
185
- 在上面的代码中,我们可以看到 ` itr ` 这一变量是定义在整个 ` main() ` 的作用域内的,这导致当我们需要再次遍历整个 ` std::vectors ` 时,需要重新命名另一个变量。C++17 消除了这一限制,使得我们可以在 ` if ` (或 ` switch ` )中完成这一操作:
185
+ 在上面的代码中,我们可以看到 ` itr ` 这一变量是定义在整个 ` main() ` 的作用域内的,这导致当我们需要再次遍历整个 ` std::vector ` 时,需要重新命名另一个变量。C++17 消除了这一限制,使得我们可以在 ` if ` (或 ` switch ` )中完成这一操作:
186
186
187
187
``` cpp
188
188
// 将临时变量放到 if 语句内
You can’t perform that action at this time.
0 commit comments