It's because the argument (std::function) is a reference. It should be:
void func(std::vector& vec, std::function f)
^ ^
|
f not a reference
So that the argument can be converted to the parameter type.
Also, the type of the function should match. I.e. it should accept a string reference.