mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Merge pull request #441 from mpark/P3
P.3: Fixed an inaccurate description of `for (const auto& x : v)`.
This commit is contained in:
commit
e7756aa5f2
|
@ -464,7 +464,7 @@ Better:
|
|||
|
||||
for (const auto& x : v) { /* do something with x */ }
|
||||
|
||||
Now, there is no explicit mention of the iteration mechanism, and the loop operates on a copy of elements so that accidental modification cannot happen. If modification is desired, say so:
|
||||
Now, there is no explicit mention of the iteration mechanism, and the loop operates on a reference to `const` elements so that accidental modification cannot happen. If modification is desired, say so:
|
||||
|
||||
for (auto& x : v) { /* do something with x */ }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user