Merge pull request #603 from royalbee/patch-1

ES.7 fix mixed index / iterator loop condition
This commit is contained in:
Gabriel Dos Reis 2016-05-03 11:06:13 -07:00
commit 8e82f0a0d9

View File

@ -8166,7 +8166,7 @@ Conventional short, local names increase readability:
template<typename T> // good
void print(ostream& os, const vector<T>& v)
{
for (int i = 0; i < v.end(); ++i)
for (int i = 0; i < v.size(); ++i)
os << v[i] << '\n';
}
@ -8176,7 +8176,7 @@ An index is conventionally called `i` and there is no hint about the meaning of
void print(ostream& target_stream, const vector<Element_type>& current_vector)
{
for (int current_element_index = 0;
current_element_index < current_vector.end();
current_element_index < current_vector.size();
++current_element_index
)
target_stream << current_vector[i] << '\n';