Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
shidenggui committed Dec 23, 2014
1 parent 1dc88f1 commit 13681f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ch09/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Chapter 9. Sequential Containers
# Chapter 9. Sequential Containers

## Exercise 9.1:
>Which is the most appropriate—a vector, a deque, or a list—for the following program tasks?
Expand Down Expand Up @@ -94,6 +94,11 @@ const vector<int> v2;
auto it1 = v1.begin(), it2 = v2.begin();
auto it3 = v1.cbegin(), it4 = v2.cbegin();
```
In gcc 4.8, will report error:
error: inconsistent deduction for ‘auto’: ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ and then ‘__gnu_cxx::__normal_iterator<const int*, std::vector<int> >’ auto it1 = v1.begin(), it2 = v2.begin();
the correct code should be
auto it1 = v1.begin();
auto it2 = v2.begin(), it3 = v1.cbegin(), it4 = v2.cbegin();

`it1` is `vector<int>::iterator`

Expand Down

0 comments on commit 13681f8

Please sign in to comment.