Skip to content

Commit 237c990

Browse files
authored
book: typo fixes (changkun#248)
1 parent 2e9eed9 commit 237c990

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

book/en-us/02-usability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

385385
When we have `auto`:

book/zh-cn/02-usability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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` 之后可以:

0 commit comments

Comments
 (0)