Ok so I have 1 user-defined type named fraction
and it represents and ordinary fraction with a numerator and denominator. Here is the code:
class Fr
Consider this code:
Fraction a, b;
bool res = (a < b);
The second line is essentially a call to
bool res = a.operator<(b);
bool operator<(const Fraction&) const
to make the sorting implementation happy or just go with the first suggestion above - be const-correct with bool operator<(const Fraction& a, const Fraction& b)