Replace deprecated std::binary_function
std::binary_function has been deprecated since C++11 and removed in C++17. The standard way to replace it in code is to explicitly list the member typedefs (see, e.g., https://stackoverflow.com/a/33115140), which is what is done in this commit. This makes the code future-proof and removes a lot of warnings when compiling.