Daily bit(e) of C++ | std::for_each
Daily bit(e) of C++ #60, The simplest C++ algorithm: std::for_each
The std::for_each
algorithm invokes the provided functor on each range element in order, ignoring the result.
While the range-based for-loop has mostly replaced the use cases for std::for_each
, it still comes in handy as a trivial parallelization tool and in its C++20 range version with projections.