I just read the code for std::for_each:
template<class InputIterator, class Function>
Function for_each(InputIterator first, InputIterator last, Function f)
{
for ( ; first!=last; ++first ) f(*first);
return f;
}
and could not see any good reasons for this template function to return the input function. Does anyone have any examples on where this would be useful?