-
Couldn't load subscription status.
- Fork 130
Open
Description
The BigInt relational operators, for example BigInt::operator> are not optimal.
Currently, the code is:
bool BigInt::operator>(const BigInt& num) const {
return !((*this < num) or (*this == num));
}
This potentially makes two calls, one to operator< and another to operator ==. Only one call needs to be made:
bool BigInt::operator>(const BigInt& num) const {
return *this < num;
}
The same issue with <=, where it takes just < to give the right results. Here is the corrected code:
bool BigInt::operator<=(const BigInt& num) const {
return !(num < *this);
}
Metadata
Metadata
Assignees
Labels
No labels