For_Each and Reduce Algorithms

This lesson goes into the details of reduce algorithm and its working.

for_each Algorithm

In the serial version of for_each, the version that was available before C++17 you get a unary function as a return value from the algorithm.

Returning such an object is not possible in a parallel version, as the order of invocations is indeterminate.

Here’s a basic example:

Get hands-on with 1200+ tech skills courses.