- 1
- 2
- 3
- 4
Fixed& operator +=(Fixed a) { return *this = *this + a; return *this; }
Fixed& operator -=(Fixed a) { return *this = *this - a; return *this; }
Fixed& operator *=(Fixed a) { return *this = *this * a; return *this; }
Fixed& operator /=(Fixed a) { return *this = *this / a; return *this; }
получается эквивалентно Fixed tmp(this->operator + (a)); return this->operator = (tmp);
далее работает оптимизатор
второй return *this; в каждом не нужен, естесно
передавай const & в параметры, пожалуйста
Вот нечто подобное этой конструкции gсс превращал в один mul.