A piece of code for vector operations contains these class template definitions:
template <class T>
class lt {
public:
static int compare(T a, T b) { return(a < b); }
};
template <class T>
class gt {
public:
static int compare(T a, T b) { return(a > b); }
};
But why? It's not using extra exception handling, and it relies on objects of class T
already having operator<
and operator>
. Is it not just as easy/easier to use the operators? Or should one use template classes for comparisons?