From ff4755d5e58705aab16c56096e320bf3fa4e5846 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Wed, 13 Sep 2023 20:11:59 +0200 Subject: [PATCH] feat: `quantity_ref_from` disallowed for rvalues --- src/core/include/mp-units/quantity_point.h | 20 +- test/unit_test/static/quantity_point_test.cpp | 225 ++++++++---------- 2 files changed, 107 insertions(+), 138 deletions(-) diff --git a/src/core/include/mp-units/quantity_point.h b/src/core/include/mp-units/quantity_point.h index 68dc3c4f9..bcf48acb8 100644 --- a/src/core/include/mp-units/quantity_point.h +++ b/src/core/include/mp-units/quantity_point.h @@ -146,34 +146,20 @@ class quantity_point { } // data access -#ifdef __cpp_explicit_this_parameter - template> PO2> - [[nodiscard]] constexpr auto&& quantity_ref_from(this Self&& self, PO2) noexcept - { - return std::forward(self).quantity_from_origin_; - } -#else template> PO2> [[nodiscard]] constexpr quantity_type& quantity_ref_from(PO2) & noexcept { return quantity_from_origin_; } + template> PO2> [[nodiscard]] constexpr const quantity_type& quantity_ref_from(PO2) const& noexcept { return quantity_from_origin_; } + template> PO2> - [[nodiscard]] constexpr quantity_type&& quantity_ref_from(PO2) && noexcept - { - return std::move(quantity_from_origin_); - } - template> PO2> - [[nodiscard]] constexpr const quantity_type&& quantity_ref_from(PO2) const&& noexcept - { - return std::move(quantity_from_origin_); - } -#endif + constexpr const quantity_type&& quantity_ref_from(PO2) const&& noexcept = delete; template requires requires { quantity_point{} - PO2{}; } diff --git a/test/unit_test/static/quantity_point_test.cpp b/test/unit_test/static/quantity_point_test.cpp index f7c5eb316..feb633d65 100644 --- a/test/unit_test/static/quantity_point_test.cpp +++ b/test/unit_test/static/quantity_point_test.cpp @@ -241,24 +241,19 @@ static_assert( // static member functions //////////////////////////// -static_assert( - quantity_point::zero().quantity_ref_from(mean_sea_level).numerical_value_ == 0); -static_assert( - quantity_point::min().quantity_ref_from(mean_sea_level).numerical_value_ == - std::numeric_limits::lowest()); -static_assert( - quantity_point::max().quantity_ref_from(mean_sea_level).numerical_value_ == - std::numeric_limits::max()); +static_assert(quantity_point::zero().quantity_from_origin_.numerical_value_ == 0); +static_assert(quantity_point::min().quantity_from_origin_.numerical_value_ == + std::numeric_limits::lowest()); +static_assert(quantity_point::max().quantity_from_origin_.numerical_value_ == + std::numeric_limits::max()); static_assert( - quantity_point::zero().quantity_ref_from(ground_level).numerical_value_ == 0); -static_assert( - quantity_point::min().quantity_ref_from(ground_level).numerical_value_ == - std::numeric_limits::lowest()); -static_assert( - quantity_point::max().quantity_ref_from(ground_level).numerical_value_ == - std::numeric_limits::max()); + quantity_point::zero().quantity_from_origin_.numerical_value_ == 0); +static_assert(quantity_point::min().quantity_from_origin_.numerical_value_ == + std::numeric_limits::lowest()); +static_assert(quantity_point::max().quantity_from_origin_.numerical_value_ == + std::numeric_limits::max()); ////////////////////////////// @@ -544,42 +539,36 @@ static_assert( // obtaining a relative quantity ////////////////////////////////// -static_assert((mean_sea_level + 42 * m).quantity_ref_from(mean_sea_level) == 42 * m); -static_assert((mean_sea_level + isq::height(42 * m)).quantity_ref_from(mean_sea_level) == 42 * m); +static_assert((mean_sea_level + 42 * m).quantity_from_origin_ == 42 * m); +static_assert((mean_sea_level + isq::height(42 * m)).quantity_from_origin_ == 42 * m); -static_assert((zero + 1 * one).quantity_ref_from(zero) == 1 * one); -static_assert((zero + dimensionless(1 * one)).quantity_ref_from(zero) == 1 * one); +static_assert((zero + 1 * one).quantity_from_origin_ == 1 * one); +static_assert((zero + dimensionless(1 * one)).quantity_from_origin_ == 1 * one); -static_assert((mean_sea_level + 42 * m).quantity_ref_from(mean_sea_level) == 42 * m); -static_assert((ground_level + 42 * m).quantity_ref_from(ground_level) == 42 * m); -static_assert((tower_peak + 42 * m).quantity_ref_from(tower_peak) == 42 * m); +static_assert((mean_sea_level + 42 * m).quantity_from_origin_ == 42 * m); +static_assert((ground_level + 42 * m).quantity_from_origin_ == 42 * m); +static_assert((tower_peak + 42 * m).quantity_from_origin_ == 42 * m); -static_assert(quantity_point(ground_level + 42 * m).quantity_ref_from(mean_sea_level) == - 84 * m); -static_assert(quantity_point(tower_peak + 42 * m).quantity_ref_from(mean_sea_level) == - 126 * m); +static_assert(quantity_point(ground_level + 42 * m).quantity_from_origin_ == 84 * m); +static_assert(quantity_point(tower_peak + 42 * m).quantity_from_origin_ == 126 * m); -static_assert(quantity_point(mean_sea_level + 84 * m).quantity_ref_from(ground_level) == - 42 * m); -static_assert(quantity_point(tower_peak + 42 * m).quantity_ref_from(ground_level) == - 84 * m); +static_assert(quantity_point(mean_sea_level + 84 * m).quantity_from_origin_ == 42 * m); +static_assert(quantity_point(tower_peak + 42 * m).quantity_from_origin_ == 84 * m); -static_assert(quantity_point(mean_sea_level + 42 * m).quantity_ref_from(tower_peak) == - -42 * m); -static_assert(quantity_point(ground_level + 84 * m).quantity_ref_from(tower_peak) == - 42 * m); +static_assert(quantity_point(mean_sea_level + 42 * m).quantity_from_origin_ == -42 * m); +static_assert(quantity_point(ground_level + 84 * m).quantity_from_origin_ == 42 * m); -static_assert((mean_sea_level + 42 * m).point_for(mean_sea_level).quantity_ref_from(mean_sea_level) == 42 * m); -static_assert((ground_level + 42 * m).point_for(mean_sea_level).quantity_ref_from(mean_sea_level) == 84 * m); -static_assert((tower_peak + 42 * m).point_for(mean_sea_level).quantity_ref_from(mean_sea_level) == 126 * m); +static_assert((mean_sea_level + 42 * m).point_for(mean_sea_level).quantity_from_origin_ == 42 * m); +static_assert((ground_level + 42 * m).point_for(mean_sea_level).quantity_from_origin_ == 84 * m); +static_assert((tower_peak + 42 * m).point_for(mean_sea_level).quantity_from_origin_ == 126 * m); -static_assert((ground_level + 84 * m).point_for(ground_level).quantity_ref_from(ground_level) == 84 * m); -static_assert((mean_sea_level + 84 * m).point_for(ground_level).quantity_ref_from(ground_level) == 42 * m); -static_assert((tower_peak + 42 * m).point_for(ground_level).quantity_ref_from(ground_level) == 84 * m); +static_assert((ground_level + 84 * m).point_for(ground_level).quantity_from_origin_ == 84 * m); +static_assert((mean_sea_level + 84 * m).point_for(ground_level).quantity_from_origin_ == 42 * m); +static_assert((tower_peak + 42 * m).point_for(ground_level).quantity_from_origin_ == 84 * m); -static_assert((tower_peak + 42 * m).point_for(tower_peak).quantity_ref_from(tower_peak) == 42 * m); -static_assert((mean_sea_level + 42 * m).point_for(tower_peak).quantity_ref_from(tower_peak) == -42 * m); -static_assert((ground_level + 84 * m).point_for(tower_peak).quantity_ref_from(tower_peak) == 42 * m); +static_assert((tower_peak + 42 * m).point_for(tower_peak).quantity_from_origin_ == 42 * m); +static_assert((mean_sea_level + 42 * m).point_for(tower_peak).quantity_from_origin_ == -42 * m); +static_assert((ground_level + 84 * m).point_for(tower_peak).quantity_from_origin_ == 42 * m); static_assert(is_of_type<(ground_level + isq::height(short(42) * m)).point_for(mean_sea_level), quantity_point>); @@ -589,15 +578,15 @@ static_assert(is_of_type<(ground_level + isq::height(short(42) * m)).point_for(m // converting to a different unit /////////////////////////////////// -static_assert((mean_sea_level + 2. * km).in(km).quantity_ref_from(mean_sea_level).numerical_value_ == 2.); -static_assert((mean_sea_level + 2. * km).in(m).quantity_ref_from(mean_sea_level).numerical_value_ == 2000.); -static_assert((mean_sea_level + 2000. * m).in(km).quantity_ref_from(mean_sea_level).numerical_value_ == 2.); -static_assert((ground_level + 2. * km).in(km).quantity_ref_from(ground_level).numerical_value_ == 2.); -static_assert((ground_level + 2. * km).in(m).quantity_ref_from(ground_level).numerical_value_ == 2000.); -static_assert((ground_level + 2000. * m).in(km).quantity_ref_from(ground_level).numerical_value_ == 2.); -static_assert((tower_peak + 2. * km).in(km).quantity_ref_from(tower_peak).numerical_value_ == 2.); -static_assert((tower_peak + 2. * km).in(m).quantity_ref_from(tower_peak).numerical_value_ == 2000.); -static_assert((tower_peak + 2000. * m).in(km).quantity_ref_from(tower_peak).numerical_value_ == 2.); +static_assert((mean_sea_level + 2. * km).in(km).quantity_from_origin_.numerical_value_ == 2.); +static_assert((mean_sea_level + 2. * km).in(m).quantity_from_origin_.numerical_value_ == 2000.); +static_assert((mean_sea_level + 2000. * m).in(km).quantity_from_origin_.numerical_value_ == 2.); +static_assert((ground_level + 2. * km).in(km).quantity_from_origin_.numerical_value_ == 2.); +static_assert((ground_level + 2. * km).in(m).quantity_from_origin_.numerical_value_ == 2000.); +static_assert((ground_level + 2000. * m).in(km).quantity_from_origin_.numerical_value_ == 2.); +static_assert((tower_peak + 2. * km).in(km).quantity_from_origin_.numerical_value_ == 2.); +static_assert((tower_peak + 2. * km).in(m).quantity_from_origin_.numerical_value_ == 2000.); +static_assert((tower_peak + 2000. * m).in(km).quantity_from_origin_.numerical_value_ == 2.); #if MP_UNITS_COMP_GCC != 10 || MP_UNITS_COMP_GCC_MINOR > 2 template typename QP> @@ -629,18 +618,18 @@ static_assert(([]() { quantity_point l1{mean_sea_level + 1 * m}, l2{mean_sea_level + 2 * m}; return l2 = l1; }()) - .quantity_ref_from(mean_sea_level) == 1 * m); + .quantity_from_origin_ == 1 * m); static_assert(([]() { const quantity_point l1{mean_sea_level + 1 * m}; quantity_point l2{mean_sea_level + 2 * m}; return l2 = l1; }()) - .quantity_ref_from(mean_sea_level) == 1 * m); + .quantity_from_origin_ == 1 * m); static_assert(([]() { quantity_point l1{mean_sea_level + 1 * m}, l2{mean_sea_level + 2 * m}; return l2 = std::move(l1); }()) - .quantity_ref_from(mean_sea_level) == 1 * m); + .quantity_from_origin_ == 1 * m); //////////////////// @@ -670,14 +659,14 @@ static_assert([](auto v) { //////////////////////// // same type -static_assert((mean_sea_level + 1 * m += 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 2); -static_assert((mean_sea_level + 2 * m -= 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 1); +static_assert((mean_sea_level + 1 * m += 1 * m).quantity_from_origin_.numerical_value_ == 2); +static_assert((mean_sea_level + 2 * m -= 1 * m).quantity_from_origin_.numerical_value_ == 1); // different types -static_assert((mean_sea_level + 2.5 * m += 3 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 5.5); -static_assert((mean_sea_level + 123 * m += 1 * km).quantity_ref_from(mean_sea_level).numerical_value_ == 1123); -static_assert((mean_sea_level + 5.5 * m -= 3 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 2.5); -static_assert((mean_sea_level + 1123 * m -= 1 * km).quantity_ref_from(mean_sea_level).numerical_value_ == 123); +static_assert((mean_sea_level + 2.5 * m += 3 * m).quantity_from_origin_.numerical_value_ == 5.5); +static_assert((mean_sea_level + 123 * m += 1 * km).quantity_from_origin_.numerical_value_ == 1123); +static_assert((mean_sea_level + 5.5 * m -= 3 * m).quantity_from_origin_.numerical_value_ == 2.5); +static_assert((mean_sea_level + 1123 * m -= 1 * km).quantity_from_origin_.numerical_value_ == 123); template typename QP> @@ -949,29 +938,23 @@ static_assert(is_of_type<(1 * m + tower_peak) - (1 * m + other_ground_level), qu // check for integral types promotion static_assert(is_same_v); static_assert(is_same_v); static_assert(is_same_v); static_assert( is_same_v< decltype(((mean_sea_level + std::uint8_t(0) * m) - (mean_sea_level + std::uint8_t(0) * m)).numerical_value_), int>); static_assert(((mean_sea_level + std::uint8_t(128) * m) + std::uint8_t(128) * m) - .quantity_ref_from(mean_sea_level) - .numerical_value_ == std::uint8_t(128) + std::uint8_t(128)); + .quantity_from_origin_.numerical_value_ == std::uint8_t(128) + std::uint8_t(128)); static_assert((std::uint8_t(128) * m + (mean_sea_level + std::uint8_t(128) * m)) - .quantity_ref_from(mean_sea_level) - .numerical_value_ == std::uint8_t(128) + std::uint8_t(128)); -static_assert( - ((mean_sea_level + std::uint8_t(0) * m) - std::uint8_t(1) * m).quantity_ref_from(mean_sea_level).numerical_value_ == - std::uint8_t(0) - std::uint8_t(1)); + .quantity_from_origin_.numerical_value_ == std::uint8_t(128) + std::uint8_t(128)); +static_assert(((mean_sea_level + std::uint8_t(0) * m) - std::uint8_t(1) * m).quantity_from_origin_.numerical_value_ == + std::uint8_t(0) - std::uint8_t(1)); static_assert(((mean_sea_level + std::uint8_t(0) * m) - (mean_sea_level + std::uint8_t(1) * m)).numerical_value_ == std::uint8_t(0) - std::uint8_t(1)); @@ -1027,32 +1010,32 @@ static_assert(is_of_type<(mean_sea_level + 1 * km) - (mean_sea_level + 1. * m), static_assert(is_of_type<(mean_sea_level + 1. * km) - (mean_sea_level + 1. * m), quantity>); -static_assert(((mean_sea_level + 1 * m) + 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 2); -static_assert((1 * m + (mean_sea_level + 1 * m)).quantity_ref_from(mean_sea_level).numerical_value_ == 2); -static_assert(((mean_sea_level + 1 * m) + 1 * km).quantity_ref_from(mean_sea_level).numerical_value_ == 1001); -static_assert((1 * m + (mean_sea_level + 1 * km)).quantity_ref_from(mean_sea_level).numerical_value_ == 1001); -static_assert(((mean_sea_level + 1 * km) + 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 1001); -static_assert((1 * km + (mean_sea_level + 1 * m)).quantity_ref_from(mean_sea_level).numerical_value_ == 1001); -static_assert(((mean_sea_level + 2 * m) - 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 1); -static_assert(((mean_sea_level + 1 * km) - 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 999); - -static_assert(((mean_sea_level + 1.5 * m) + 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 2.5); -static_assert((1.5 * m + (mean_sea_level + 1 * m)).quantity_ref_from(mean_sea_level).numerical_value_ == 2.5); -static_assert(((mean_sea_level + 1.5 * m) + 1 * km).quantity_ref_from(mean_sea_level).numerical_value_ == 1001.5); -static_assert((1.5 * m + (mean_sea_level + 1 * km)).quantity_ref_from(mean_sea_level).numerical_value_ == 1001.5); -static_assert(((mean_sea_level + 1.5 * km) + 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 1501); -static_assert((1.5 * km + (mean_sea_level + 1 * m)).quantity_ref_from(mean_sea_level).numerical_value_ == 1501); -static_assert(((mean_sea_level + 2.5 * m) - 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 1.5); -static_assert(((mean_sea_level + 1.5 * km) - 1 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 1499); - -static_assert(((mean_sea_level + 1 * m) + 1.5 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 2.5); -static_assert((1 * m + (mean_sea_level + 1.5 * m)).quantity_ref_from(mean_sea_level).numerical_value_ == 2.5); -static_assert(((mean_sea_level + 1 * m) + 1.5 * km).quantity_ref_from(mean_sea_level).numerical_value_ == 1501); -static_assert((1 * m + (mean_sea_level + 1.5 * km)).quantity_ref_from(mean_sea_level).numerical_value_ == 1501); -static_assert(((mean_sea_level + 1 * km) + 1.5 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 1001.5); -static_assert((1 * km + (mean_sea_level + 1.5 * m)).quantity_ref_from(mean_sea_level).numerical_value_ == 1001.5); -static_assert(((mean_sea_level + 2 * m) - 1.5 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 0.5); -static_assert(((mean_sea_level + 1 * km) - 1.5 * m).quantity_ref_from(mean_sea_level).numerical_value_ == 998.5); +static_assert(((mean_sea_level + 1 * m) + 1 * m).quantity_from_origin_.numerical_value_ == 2); +static_assert((1 * m + (mean_sea_level + 1 * m)).quantity_from_origin_.numerical_value_ == 2); +static_assert(((mean_sea_level + 1 * m) + 1 * km).quantity_from_origin_.numerical_value_ == 1001); +static_assert((1 * m + (mean_sea_level + 1 * km)).quantity_from_origin_.numerical_value_ == 1001); +static_assert(((mean_sea_level + 1 * km) + 1 * m).quantity_from_origin_.numerical_value_ == 1001); +static_assert((1 * km + (mean_sea_level + 1 * m)).quantity_from_origin_.numerical_value_ == 1001); +static_assert(((mean_sea_level + 2 * m) - 1 * m).quantity_from_origin_.numerical_value_ == 1); +static_assert(((mean_sea_level + 1 * km) - 1 * m).quantity_from_origin_.numerical_value_ == 999); + +static_assert(((mean_sea_level + 1.5 * m) + 1 * m).quantity_from_origin_.numerical_value_ == 2.5); +static_assert((1.5 * m + (mean_sea_level + 1 * m)).quantity_from_origin_.numerical_value_ == 2.5); +static_assert(((mean_sea_level + 1.5 * m) + 1 * km).quantity_from_origin_.numerical_value_ == 1001.5); +static_assert((1.5 * m + (mean_sea_level + 1 * km)).quantity_from_origin_.numerical_value_ == 1001.5); +static_assert(((mean_sea_level + 1.5 * km) + 1 * m).quantity_from_origin_.numerical_value_ == 1501); +static_assert((1.5 * km + (mean_sea_level + 1 * m)).quantity_from_origin_.numerical_value_ == 1501); +static_assert(((mean_sea_level + 2.5 * m) - 1 * m).quantity_from_origin_.numerical_value_ == 1.5); +static_assert(((mean_sea_level + 1.5 * km) - 1 * m).quantity_from_origin_.numerical_value_ == 1499); + +static_assert(((mean_sea_level + 1 * m) + 1.5 * m).quantity_from_origin_.numerical_value_ == 2.5); +static_assert((1 * m + (mean_sea_level + 1.5 * m)).quantity_from_origin_.numerical_value_ == 2.5); +static_assert(((mean_sea_level + 1 * m) + 1.5 * km).quantity_from_origin_.numerical_value_ == 1501); +static_assert((1 * m + (mean_sea_level + 1.5 * km)).quantity_from_origin_.numerical_value_ == 1501); +static_assert(((mean_sea_level + 1 * km) + 1.5 * m).quantity_from_origin_.numerical_value_ == 1001.5); +static_assert((1 * km + (mean_sea_level + 1.5 * m)).quantity_from_origin_.numerical_value_ == 1001.5); +static_assert(((mean_sea_level + 2 * m) - 1.5 * m).quantity_from_origin_.numerical_value_ == 0.5); +static_assert(((mean_sea_level + 1 * km) - 1.5 * m).quantity_from_origin_.numerical_value_ == 998.5); static_assert(((mean_sea_level + 2 * m) - (mean_sea_level + 1 * m)).numerical_value_ == 1); static_assert(((mean_sea_level + 1 * km) - (mean_sea_level + 1 * m)).numerical_value_ == 999); @@ -1072,15 +1055,15 @@ static_assert((ground_level + 42 * m) - (other_ground_level + 42 * m) == -81 * m static_assert((other_ground_level + 42 * m) - (tower_peak + 42 * m) == 39 * m); static_assert((tower_peak + 42 * m) - (other_ground_level + 42 * m) == -39 * m); -static_assert((mean_sea_level + 42 * m).quantity_ref_from(mean_sea_level) == 42 * m); -static_assert((42 * m + mean_sea_level).quantity_ref_from(mean_sea_level) == 42 * m); -static_assert((mean_sea_level - 42 * m).quantity_ref_from(mean_sea_level) == -42 * m); -static_assert((ground_level + 42 * m).quantity_ref_from(ground_level) == 42 * m); -static_assert((42 * m + ground_level).quantity_ref_from(ground_level) == 42 * m); -static_assert((ground_level - 42 * m).quantity_ref_from(ground_level) == -42 * m); -static_assert((tower_peak + 42 * m).quantity_ref_from(tower_peak) == 42 * m); -static_assert((42 * m + tower_peak).quantity_ref_from(tower_peak) == 42 * m); -static_assert((tower_peak - 42 * m).quantity_ref_from(tower_peak) == -42 * m); +static_assert((mean_sea_level + 42 * m).quantity_from_origin_ == 42 * m); +static_assert((42 * m + mean_sea_level).quantity_from_origin_ == 42 * m); +static_assert((mean_sea_level - 42 * m).quantity_from_origin_ == -42 * m); +static_assert((ground_level + 42 * m).quantity_from_origin_ == 42 * m); +static_assert((42 * m + ground_level).quantity_from_origin_ == 42 * m); +static_assert((ground_level - 42 * m).quantity_from_origin_ == -42 * m); +static_assert((tower_peak + 42 * m).quantity_from_origin_ == 42 * m); +static_assert((42 * m + tower_peak).quantity_from_origin_ == 42 * m); +static_assert((tower_peak - 42 * m).quantity_from_origin_ == -42 * m); static_assert((mean_sea_level + 42 * m) - ground_level == 0 * m); static_assert((ground_level + 42 * m) - mean_sea_level == 84 * m); @@ -1131,17 +1114,17 @@ inline constexpr struct zero_m_per_s : absolute_point_origin // commutativity and associativity static_assert(((zero_m_per_s + 10 * isq::height[m] / (2 * isq::time[s])) + 5 * isq::speed[m / s]) - .quantity_ref_from(zero_m_per_s) == 10 * isq::speed[m / s]); + .quantity_from_origin_ == 10 * isq::speed[m / s]); static_assert((10 * isq::height[m] / (2 * isq::time[s]) + (zero_m_per_s + 5 * isq::speed[m / s])) - .quantity_ref_from(zero_m_per_s) == 10 * isq::speed[m / s]); + .quantity_from_origin_ == 10 * isq::speed[m / s]); static_assert(((zero_m_per_s + 5 * isq::speed[m / s]) + 10 * isq::height[m] / (2 * isq::time[s])) - .quantity_ref_from(zero_m_per_s) == 10 * isq::speed[m / s]); + .quantity_from_origin_ == 10 * isq::speed[m / s]); static_assert((5 * isq::speed[m / s] + (zero_m_per_s + 10 * isq::height[m] / (2 * isq::time[s]))) - .quantity_ref_from(zero_m_per_s) == 10 * isq::speed[m / s]); + .quantity_from_origin_ == 10 * isq::speed[m / s]); static_assert(((zero_m_per_s + 10 * isq::height[m] / (2 * isq::time[s])) - 5 * isq::speed[m / s]) - .quantity_ref_from(zero_m_per_s) == 0 * isq::speed[m / s]); + .quantity_from_origin_ == 0 * isq::speed[m / s]); static_assert(((zero_m_per_s + 5 * isq::speed[m / s]) - 10 * isq::height[m] / (2 * isq::time[s])) - .quantity_ref_from(zero_m_per_s) == 0 * isq::speed[m / s]); + .quantity_from_origin_ == 0 * isq::speed[m / s]); static_assert((zero_m_per_s + 10 * isq::height[m] / (2 * isq::time[s])) - (zero_m_per_s + 5 * isq::speed[m / s]) == 0 * isq::speed[m / s]); static_assert((zero_m_per_s + 5 * isq::speed[m / s]) - (zero_m_per_s + 10 * isq::height[m] / (2 * isq::time[s])) == @@ -1173,17 +1156,17 @@ static_assert( inline constexpr struct zero_Hz : absolute_point_origin> { } zero_Hz; -static_assert(((zero_Hz + 10 / (2 * isq::period_duration[s])) + 5 * isq::frequency[Hz]).quantity_ref_from(zero_Hz) == +static_assert(((zero_Hz + 10 / (2 * isq::period_duration[s])) + 5 * isq::frequency[Hz]).quantity_from_origin_ == 10 * isq::frequency[Hz]); -static_assert((10 / (2 * isq::period_duration[s]) + (zero_Hz + 5 * isq::frequency[Hz])).quantity_ref_from(zero_Hz) == +static_assert((10 / (2 * isq::period_duration[s]) + (zero_Hz + 5 * isq::frequency[Hz])).quantity_from_origin_ == 10 * isq::frequency[Hz]); -static_assert(((zero_Hz + 5 * isq::frequency[Hz]) + 10 / (2 * isq::period_duration[s])).quantity_ref_from(zero_Hz) == +static_assert(((zero_Hz + 5 * isq::frequency[Hz]) + 10 / (2 * isq::period_duration[s])).quantity_from_origin_ == 10 * isq::frequency[Hz]); -static_assert((5 * isq::frequency[Hz] + (zero_Hz + 10 / (2 * isq::period_duration[s]))).quantity_ref_from(zero_Hz) == +static_assert((5 * isq::frequency[Hz] + (zero_Hz + 10 / (2 * isq::period_duration[s]))).quantity_from_origin_ == 10 * isq::frequency[Hz]); -static_assert(((zero_Hz + 10 / (2 * isq::period_duration[s])) - 5 * isq::frequency[Hz]).quantity_ref_from(zero_Hz) == +static_assert(((zero_Hz + 10 / (2 * isq::period_duration[s])) - 5 * isq::frequency[Hz]).quantity_from_origin_ == 0 * isq::frequency[Hz]); -static_assert(((zero_Hz + 5 * isq::frequency[Hz]) - 10 / (2 * isq::period_duration[s])).quantity_ref_from(zero_Hz) == +static_assert(((zero_Hz + 5 * isq::frequency[Hz]) - 10 / (2 * isq::period_duration[s])).quantity_from_origin_ == 0 * isq::frequency[Hz]); static_assert((zero_Hz + 10 / (2 * isq::period_duration[s])) - (zero_Hz + 5 * isq::frequency[Hz]) == 0 * isq::frequency[Hz]);