mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Closes #1254
This commit is contained in:
parent
5b372a99d8
commit
60e19d76a4
|
@ -599,7 +599,7 @@ Now, there is no explicit mention of the iteration mechanism, and the loop opera
|
||||||
for (auto& x : v) { /* modify x */ }
|
for (auto& x : v) { /* modify x */ }
|
||||||
|
|
||||||
For more details about for-statements, see [ES.71](#Res-for-range).
|
For more details about for-statements, see [ES.71](#Res-for-range).
|
||||||
Sometimes better still, use a named algorithm:
|
Sometimes better still, use a named algorithm. This example uses the `for_each` from the Ranges TS because it directly expresses the intent:
|
||||||
|
|
||||||
for_each(v, [](int x) { /* do something with the value of x */ });
|
for_each(v, [](int x) { /* do something with the value of x */ });
|
||||||
for_each(par, v, [](int x) { /* do something with the value of x */ });
|
for_each(par, v, [](int x) { /* do something with the value of x */ });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user