From a4171e2fb61da2ca5a6316e51cf31e7e8ede0153 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 25 May 2023 12:15:52 +0200 Subject: [PATCH] docs: some comments and TODOs added --- example/capacitor_time_curve.cpp | 2 ++ src/core/include/mp_units/quantity_spec.h | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/example/capacitor_time_curve.cpp b/example/capacitor_time_curve.cpp index 2a5d99da..e98004c5 100644 --- a/example/capacitor_time_curve.cpp +++ b/example/capacitor_time_curve.cpp @@ -41,6 +41,8 @@ int main() for (auto t = 0 * ms; t <= 50 * ms; ++t) { const QuantityOf auto Vt = V0 * exp(dimensionless(-t / (R * C))); + // TODO try to make the below work instead + // const QuantityOf auto Vt = V0 * exp(-t / (R * C)); std::cout << "at " << t << " voltage is "; diff --git a/src/core/include/mp_units/quantity_spec.h b/src/core/include/mp_units/quantity_spec.h index db9119e3..e22cf1be 100644 --- a/src/core/include/mp_units/quantity_spec.h +++ b/src/core/include/mp_units/quantity_spec.h @@ -313,7 +313,8 @@ struct quantity_spec : std::remove_const_t { * For example: * * @code{.cpp} - * inline constexpr struct velocity : quantity_spec {} velocity; + * inline constexpr struct angular_measure : quantity_spec {} + * angular_measure; inline constexpr struct velocity : quantity_spec {} velocity; * inline constexpr struct weight : quantity_spec {} weight; * inline constexpr struct kinetic_energy : quantity_spec(speed)> {} kinetic_energy; * @endcode @@ -517,6 +518,11 @@ template requires detail::non_zero [[nodiscard]] consteval QuantitySpec auto pow(Q q) { + // TODO Does the below make sense? + // `2 * 2` should compare to `4` + // `2 * one * (2 * one)` should compare to `4 * one` + // `2 * rad * (2 * rad)` should compare to `4 * rad^2` + // all are dimensionless quantities :-( if constexpr (q == dimensionless) return q; else if constexpr (Num == 1 && Den == 1)