CppCoreGuidelines
CppCoreGuidelines copied to clipboard
P.3 needs to be updated now the Ranges TS is part of the standard
I propose that the second example is removed:
for_each(par, v, [](int x) { /* do something with the value of x */ });
as passing an ExecutionPolicy
is not possible in the final version
To avoid confusion with (std::
)for_each
, I would also suggest that ranges::for_each
is used.
Related: #1254
The intent is still "makes it clear that we are not interested in the order in which the elements of v are handled." - I'd say if we are to downgrade it to standard, it should be for_each(par, begin(v), end(v), [](int x) { ...
for_each(ranges, [](int x) {....
for_each(par, first, last, [](int x) {....
is enough to demonstrate the intent and the syntax is clear.
The constrained algos in namespace ranges
are not found by ADL so I definitely think it should be qualified as ranges::for_each(v, ...)
Editors call: Thanks! We like the approach of qualifying the first one with ranges::
and removing the second one that uses par
. Also update the reference to the Ranges TS please. Would you submit a PR please?
There's no rangified parallel algorithms in Ranges TS or even C++20/23... Should we refer to P0836 for these proposed algorithms?
I think that paper was ~~abandoned and/or rejected~~ never discussed and seems moribund. P2408 will make many parallel algos usable for views and other ranges.