Map function in modern c++
I think one thing that you could do is to call result.reserve(items.size()) (as long as you expect that items can be queried for size()) just after you declare it. That would prevent the vector from allocating new space each time new element is added and/or being copied from time to time as the elements are being added to it, which may result in increased performance, especially when items contains a lot of elements and/or of large size.

It's possible that compiler optimizations would do the same to you, but it won't hurt if you put it anyway just in case. Besides, optimizations might be turned off in debug mode.

Also, since you don't modify items, it's better to make it const auto&amp; for the sake of const correctness and pass it by reference to avoid unnecessary copying as @Deduplicator has pointed out. The same goes for item in the range loop if fun is not to modify it.