std::function requires the function to be CopyConstructable and thus does not allow you to capture by move, which is exactly what we need.