diff --git a/example/include/ranged_representation.h b/example/include/ranged_representation.h index ea028fb2e..f22e83bcc 100644 --- a/example/include/ranged_representation.h +++ b/example/include/ranged_representation.h @@ -45,35 +45,19 @@ class ranged_representation : public validated_type>::validated_type; constexpr ranged_representation() : validated_type>(T{}) {} - [[nodiscard]] constexpr ranged_representation operator-() const - requires requires(T t) { -t; } - { - return ranged_representation(-this->value()); - } - - [[nodiscard]] friend constexpr ranged_representation operator-(const ranged_representation& lhs, - const ranged_representation& rhs) - { - return ranged_representation(lhs.value() - rhs.value()); - } + [[nodiscard]] constexpr ranged_representation operator-() const { return ranged_representation(-this->value()); } - constexpr ranged_representation& operator+=(const ranged_representation& that) + constexpr ranged_representation& operator+=(const T& that) { - this->value() += that.value(); - gsl_Expects(validate(this->value())); - return *this; + return *this = ranged_representation(this->value() + that); } - constexpr ranged_representation& operator-=(const ranged_representation& that) + constexpr ranged_representation& operator-=(const T& that) { - this->value() -= that.value(); - gsl_Expects(validate(this->value())); - return *this; + return *this = ranged_representation(this->value() - that); } constexpr ranged_representation& operator*=(const T& rhs) { - this->value() *= rhs; - gsl_Expects(validate(this->value())); - return *this; + return *this = ranged_representation(this->value() * rhs); } };