File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -378,8 +378,8 @@ One of the most common and notable examples of type derivation using `auto` is t
378378``` cpp
379379// before C++11
380380// cbegin() returns vector<int>::const_iterator
381- // and therefore itr is type vector<int>::const_iterator
382- for (vector<int >::const_iterator it = vec.cbegin(); itr != vec.cend(); ++it)
381+ // and therefore it is type vector<int>::const_iterator
382+ for (vector<int >::const_iterator it = vec.cbegin(); it != vec.cend(); ++it)
383383```
384384
385385When we have ` auto ` :
Original file line number Diff line number Diff line change @@ -314,8 +314,8 @@ C++11 引入了 `auto` 和 `decltype` 这两个关键字实现了类型推导,
314314``` cpp
315315// 在 C++11 之前
316316// 由于 cbegin() 将返回 vector<int>::const_iterator
317- // 所以 itr 也应该是 vector<int>::const_iterator 类型
318- for (vector<int >::const_iterator it = vec.cbegin(); itr != vec.cend(); ++it)
317+ // 所以 it 也应该是 vector<int>::const_iterator 类型
318+ for (vector<int >::const_iterator it = vec.cbegin(); it != vec.cend(); ++it)
319319```
320320
321321而有了 ` auto ` 之后可以:
You can’t perform that action at this time.
0 commit comments