From eead279c58fde5aac904cd108b21c8fbf6f49c8f Mon Sep 17 00:00:00 2001 From: Xpol Wan Date: Tue, 14 Jun 2016 17:46:24 +0800 Subject: [PATCH] compound assignments should implement the operation themself. rather than depends on binary arithmetic operators, instead, binary arithmetic operators should reuse compound assignments. --- source/cell/index_types.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/cell/index_types.cpp b/source/cell/index_types.cpp index 28931c19..94d3045a 100644 --- a/source/cell/index_types.cpp +++ b/source/cell/index_types.cpp @@ -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 &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; }