mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Fix #30
The loop variable should be a reference in order to effect the modification of the array elements.
This commit is contained in:
parent
e85995ed0b
commit
f18b83a563
|
@ -683,7 +683,7 @@ We could check earlier and improve the code:
|
|||
|
||||
void increment2(array_view<int> p)
|
||||
{
|
||||
for (int x : p) ++x;
|
||||
for (int& x : p) ++x;
|
||||
}
|
||||
|
||||
void use2(int m)
|
||||
|
|
Loading…
Reference in New Issue
Block a user