The problem of passing function objects by reference vs. by value should be handled in some more general way, because it places the burden on the algorithm user which usually does not know whether copying is intended or not (at least not at the point of calling the algorithm).