C++ includes useful generic functions like
std::transform, which can be very handy. Unfortunately they can also be quite cumbersome to use, particularly if the functor you would like to apply is unique to the particular function.
C++11 introduces lambdas allow you to write an inline, anonymous functor to replace the
struct f. For small simple examples this can be cleaner to read (it keeps everything in one place) and potentially simpler to maintain,