Replace deprecated std::ptr_fun
std::ptr_fun has been deprecated since C++11 and removed in C++17. A (not very elegant) way to replace it in code is to use std::function (see, e.g., https://stackoverflow.com/a/40576028), which is what is done in this commit. This makes the code future-proof and removes a warning when compiling.