uses binary function objects instead of lambdas

NOTE this avoids using C++11 features