Explain what are the requirements on T that makes this definition legitimate?
template<typename T>
bool operator<(const T& x, const T& y) {
return false;
}
Any type whose instances are all considered to be "equal".
a < b; // false
b < a; // false
The above is perfectly fine for a == b
. So, for consistency, if T
had an operator==
, it should always return true
.