From f80fa9f5fadb5ee090d0b3dd4d481eff6dcef9cc Mon Sep 17 00:00:00 2001 From: Ameen Ali Date: Tue, 22 Sep 2015 21:45:51 +0300 Subject: [PATCH] update at ES.72 rule add code sample for (Prefer a `for`-statement to a `while`-statement when there is an obvious loop variable) rule --- CppCoreGuidelines.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 9794ac8..8d8fef7 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -7192,7 +7192,15 @@ This will copy each elements of `vs` into `s`. Better **Example**: - ??? + for (int i = 0; i < vec.size(); i++) { + // do work + } + + int i = 0; + while (i < vec.size()) { + // do work + i++; + } **Enforcement**: ???