From f18b83a563826bbd81b0a8763fe1f194e72c4b75 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sun, 20 Sep 2015 10:26:34 -0700 Subject: [PATCH] Fix #30 The loop variable should be a reference in order to effect the modification of the array elements. --- CppCoreGuidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index dd69470..feee6bc 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -683,7 +683,7 @@ We could check earlier and improve the code: void increment2(array_view p) { - for (int x : p) ++x; + for (int& x : p) ++x; } void use2(int m)