diff --git a/src/core/include/mp-units/quantity.h b/src/core/include/mp-units/quantity.h index 14552fb7d..cff0d3e54 100644 --- a/src/core/include/mp-units/quantity.h +++ b/src/core/include/mp-units/quantity.h @@ -90,7 +90,7 @@ using common_quantity_for = quantity Rep = double> class quantity { public: - Rep number_; // needs to be public for a structural type + Rep value_; // needs to be public for a structural type // member types and values static constexpr Reference auto reference = R; @@ -134,7 +134,7 @@ class quantity { template Q> constexpr explicit(!std::convertible_to) quantity(const Q& q) : - number_(detail::sudo_cast(q).value()) + value_(detail::sudo_cast(q).value()) { } @@ -154,13 +154,13 @@ class quantity { template [[nodiscard]] constexpr auto&& value(this Self&& self) noexcept { - return std::forward(self).number_; + return std::forward(self).value_; } #else - [[nodiscard]] constexpr rep& value() & noexcept { return number_; } - [[nodiscard]] constexpr const rep& value() const& noexcept { return number_; } - [[nodiscard]] constexpr rep&& value() && noexcept { return std::move(number_); } - [[nodiscard]] constexpr const rep&& value() const&& noexcept { return std::move(number_); } + [[nodiscard]] constexpr rep& value() & noexcept { return value_; } + [[nodiscard]] constexpr const rep& value() const& noexcept { return value_; } + [[nodiscard]] constexpr rep&& value() && noexcept { return std::move(value_); } + [[nodiscard]] constexpr const rep&& value() const&& noexcept { return std::move(value_); } #endif template @@ -205,7 +205,7 @@ class quantity { } -> std::same_as; } { - ++number_; + ++value_; return *this; } @@ -216,7 +216,7 @@ class quantity { } -> std::common_with; } { - return make_quantity(number_++); + return make_quantity(value_++); } constexpr quantity& operator--() @@ -226,7 +226,7 @@ class quantity { } -> std::same_as; } { - --number_; + --value_; return *this; } @@ -237,7 +237,7 @@ class quantity { } -> std::common_with; } { - return make_quantity(number_--); + return make_quantity(value_--); } constexpr quantity& operator+=(const quantity& q) @@ -247,7 +247,7 @@ class quantity { } -> std::same_as; } { - number_ += q.value(); + value_ += q.value(); return *this; } @@ -258,7 +258,7 @@ class quantity { } -> std::same_as; } { - number_ -= q.value(); + value_ -= q.value(); return *this; } @@ -270,7 +270,7 @@ class quantity { } constexpr quantity& operator*=(const Value& v) { - number_ *= v; + value_ *= v; return *this; } @@ -282,7 +282,7 @@ class quantity { } constexpr quantity& operator*=(const Q& rhs) { - number_ *= rhs.value(); + value_ *= rhs.value(); return *this; } @@ -295,7 +295,7 @@ class quantity { constexpr quantity& operator/=(const Value& v) { gsl_ExpectsAudit(v != quantity_values::zero()); - number_ /= v; + value_ /= v; return *this; } @@ -308,7 +308,7 @@ class quantity { constexpr quantity& operator/=(const Q& rhs) { gsl_ExpectsAudit(rhs.value() != quantity_values::zero()); - number_ /= rhs.value(); + value_ /= rhs.value(); return *this; } @@ -320,7 +320,7 @@ class quantity { } { gsl_ExpectsAudit(q.value() != quantity_values::zero()); - number_ %= q.value(); + value_ %= q.value(); return *this; } @@ -335,7 +335,7 @@ class quantity { template requires detail::RepSafeConstructibleFrom - constexpr explicit quantity(Value&& v) : number_(std::forward(v)) + constexpr explicit quantity(Value&& v) : value_(std::forward(v)) { } };