std::for_each
The `std::for_each` algorithm in C++ is used to apply a specified function to each element in a given range, such as an array or a vector. It takes three parameters: the beginning and end of the range, and the function to be applied. This allows for concise and efficient processing of elements without the need for explicit loops.
Typically included in the `<algorithm>` header, `std::for_each` can work with both regular functions and lambda expressions. It is part of the C++ Standard Library, which provides a collection of algorithms and data structures to facilitate programming tasks.