From ba3c4b5692492560bdec8dae3f60c367f0177b57 Mon Sep 17 00:00:00 2001 From: hsutter Date: Fri, 17 Mar 2017 15:39:49 -0700 Subject: [PATCH] Updated example for Con.1 The original example was good, but it used a reference where the point of Con.1 is about declaring objects themselves const --- CppCoreGuidelines.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index cc3dfad..d82dccb 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -13975,11 +13975,9 @@ Prevents accidental or hard-to-notice change of value. ##### Example - for (const string& s : c) cout << s << '\n'; // just reading: const + for (const int i : c) cout << i << '\n'; // just reading: const - for (string& s : c) cout << s << '\n'; // BAD: just reading - - for (string& s : c) cin >> s; // needs to write: non-const + for (int i : c) cout << i << '\n'; // BAD: just reading ##### Exception