From 5ece97ed6818620952a0c4625266b90952288fea Mon Sep 17 00:00:00 2001 From: Dmitry Banschikov Date: Fri, 22 Apr 2016 19:26:58 +0300 Subject: [PATCH] Fix span C-style traversal example --- CppCoreGuidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 9851144..bbdaaff 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -2664,7 +2664,7 @@ A `span` represents a range of elements, but how do we manipulate elements of th void f(span s) { for (int x : s) cout << x << '\n'; // range traversal (guaranteed correct) - for (int i = 0; i < s.size(); ++i) cout << x << '\n'; // C-style traversal (potentially checked) + for (int i = 0; i < s.size(); ++i) cout << s[i] << '\n'; // C-style traversal (potentially checked) s[7] = 9; // random access (potentially checked) std::sort(&s[0], &s[s.size() / 2]); // extract pointers (potentially checked) }