diff --git a/ch09/README.md b/ch09/README.md index e1579696..c9515fb4 100644 --- a/ch09/README.md +++ b/ch09/README.md @@ -94,11 +94,21 @@ const vector 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 >’ and then ‘__gnu_cxx::__normal_iterator >’ auto it1 = v1.begin(), it2 = v2.begin(); -the correct code should be + +----- + +[@shidenggui](https://github.com/shidenggui): + +The question example codes have an error in `gcc 4.8`: +>**error**: inconsistent deduction for ‘auto’: ‘__gnu_cxx::__normal_iterator >’ and then ‘__gnu_cxx::__normal_iterator >’ auto it1 = v1.begin(), it2 = v2.begin(); + +the correct codes should be: +```cpp auto it1 = v1.begin(); -auto it2 = v2.begin(), it3 = v1.cbegin(), it4 = v2.cbegin(); +auto it2 = v2.begin(), it3 = v1.cbegin(), it4 = v2.cbegin(); +``` + +----- `it1` is `vector::iterator`