Hi

Can someone please write some "compare and contrast" notes for

"Template functions vs. function objects"? When to use one and not the

other? For example, the TF square_f does the same thing as the FO

square_o in the following. When MUST you use one over the other, and

when MIGHT you use one over the other?

Thanks a bunch.....

#include <iostream.h>

template<class T> class Square {

public:

T operator()(const T& t) {

return t*t;

}

};

template<class T> T square_f(const T& t) {

return t*t;

}

int main(int argc, char **argv) {

Square<int> square_o;

cout << square_o(5);

cout << square_f(5);

return 0;

}