Merge pull request #405 from Alexolut/patch-2

fixed a typos because of zero-based indexing
This commit is contained in:
Gabriel Dos Reis 2015-11-25 04:37:22 -08:00
commit 6634ea7d79

View File

@ -8247,10 +8247,10 @@ Readability. Error prevention. Efficiency.
for (int i = 1; i < v.size(); ++i) // touches two elements: can't be a range-for
cout << v[i] + v[i-1] << '\n';
for (int i = 1; i < v.size(); ++i) // possible side-effect: can't be a range-for
for (int i = 0; i < v.size(); ++i) // possible side-effect: can't be a range-for
cout << f(&v[i]) << '\n';
for (int i = 1; i < v.size(); ++i) { // body messes with loop variable: can't be a range-for
for (int i = 0; i < v.size(); ++i) { // body messes with loop variable: can't be a range-for
if (i % 2)
++i; // skip even elements
else