Use std::tr1::function (as we do elsewhere) to fix compilation in Clang