compound assignments should implement the operation themself.

rather than depends on binary arithmetic operators, instead, binary arithmetic operators should reuse compound assignments.
This commit is contained in:
Xpol Wan 2016-06-14 17:46:24 +08:00
parent da59c4a121
commit eead279c58

View File

@ -166,15 +166,15 @@ column_t operator/(column_t lhs, const column_t& rhs) { lhs /= rhs; return lhs;
column_t operator%(column_t lhs, const column_t& rhs) { lhs %= rhs; return lhs; } column_t operator%(column_t lhs, const column_t& rhs) { lhs %= rhs; return lhs; }
column_t &column_t::operator+=(const column_t &rhs) { return *this = (*this + rhs); } column_t &column_t::operator+=(const column_t &rhs) { index += rhs.index; return *this; }
column_t &column_t::operator-=(const column_t &rhs) { return *this = (*this - rhs); } column_t &column_t::operator-=(const column_t &rhs) { index -= rhs.index; return *this; }
column_t &column_t::operator*=(const column_t &rhs) { return *this = (*this * rhs); } column_t &column_t::operator*=(const column_t &rhs) { index *= rhs.index; return *this; }
column_t &column_t::operator/=(const column_t &rhs) { return *this = (*this / rhs); } column_t &column_t::operator/=(const column_t &rhs) { index /= rhs.index; return *this; }
column_t &column_t::operator%=(const column_t &rhs) { return *this = (*this % rhs); } column_t &column_t::operator%=(const column_t &rhs) { index %= rhs.index; return *this; }
bool operator>(const column_t::index_t &left, const column_t &right) { return column_t(left) > right; } bool operator>(const column_t::index_t &left, const column_t &right) { return column_t(left) > right; }