From e2a2076c8da201e97cd769ec14054bd4326847a9 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 23 Dec 2022 18:01:51 +0100 Subject: [PATCH] style: quantity header cleanup --- src/core/include/units/quantity.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/core/include/units/quantity.h b/src/core/include/units/quantity.h index e90b738f..512fc7ec 100644 --- a/src/core/include/units/quantity.h +++ b/src/core/include/units/quantity.h @@ -71,10 +71,9 @@ concept invoke_result_of_ = * @brief A quantity * * Property of a phenomenon, body, or substance, where the property has a magnitude that can be - * expressed by means of a number and a measurement unit. + * expressed by means of a number and a reference. * - * @tparam D a dimension of the quantity (can be either a BaseDimension or a DerivedDimension) - * @tparam U a measurement unit of the quantity + * @tparam R a reference of the quantity providing all information about quantity properties * @tparam Rep a type to be used to represent values of a quantity */ template Rep = double> @@ -82,11 +81,11 @@ class quantity { Rep number_; public: // member types and values - using rep = Rep; static constexpr Reference auto reference = R; - static constexpr QuantitySpec auto quantity_spec = R.quantity_spec; - static constexpr Dimension auto dimension = R.dimension; - static constexpr Unit auto unit = R.unit; + static constexpr QuantitySpec auto quantity_spec = reference.quantity_spec; + static constexpr Dimension auto dimension = reference.dimension; + static constexpr Unit auto unit = reference.unit; + using rep = Rep; // static member functions [[nodiscard]] static constexpr quantity zero() noexcept @@ -253,6 +252,7 @@ public: number_ *= rhs; return *this; } + template constexpr quantity& operator*=(const Q& rhs) requires requires(rep a, const typename Q::rep b) { @@ -277,6 +277,7 @@ public: number_ /= rhs; return *this; } + template constexpr quantity& operator/=(const Q& rhs) requires requires(rep a, const typename Q::rep b) {