Are there any advantages of std::for_each over for loop? To me, std::for_each only seems to hinder the readability of code. Why do then some coding
for
std::for_each
You can have the iterator be a call to a function that is performed on each iteration through the loop.
See here: http://www.cplusplus.com/reference/algorithm/for_each/