From 22dbb5e529db88a29593c67329f92bae28caf0a4 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 7 May 2024 15:21:17 -0400 Subject: [PATCH] xo-unit: streamline: rename namespacesu -> u --- example/ex1/ex1.cpp | 4 +- example/ex2/ex2.cpp | 6 +-- example/ex3/ex3.cpp | 6 +-- example/ex7/ex7.cpp | 5 +- include/xo/unit/quantity.hpp | 88 +++++++++++++++--------------- include/xo/unit/scaled_unit.hpp | 94 ++++++++++++++++++--------------- utest/quantity.test.cpp | 4 +- utest/scaled_unit.test.cpp | 6 +-- utest/unit.test.cpp | 2 +- utest/xquantity.test.cpp | 32 +++++------ 10 files changed, 126 insertions(+), 121 deletions(-) diff --git a/example/ex1/ex1.cpp b/example/ex1/ex1.cpp index cc6ee8cb..f1dfe275 100644 --- a/example/ex1/ex1.cpp +++ b/example/ex1/ex1.cpp @@ -7,7 +7,7 @@ int main () { namespace q = xo::qty::qty; - namespace su = xo::qty::su; + namespace u = xo::qty::u; using xo::qty::quantity; using xo::flatstring; using namespace std; @@ -43,7 +43,7 @@ main () { static_assert(a.scale() == 0.625); static_assert(a.abbrev() == flatstring("km.min^-2")); - constexpr auto a2 = a.rescale_ext<(su::meter / (su::second * su::second))>(); + constexpr auto a2 = a.rescale_ext<(u::meter / (u::second * u::second))>(); cerr << "d.t^-2: " << a2 << endl; diff --git a/example/ex2/ex2.cpp b/example/ex2/ex2.cpp index 97d32e0f..94fa9054 100644 --- a/example/ex2/ex2.cpp +++ b/example/ex2/ex2.cpp @@ -7,7 +7,7 @@ int main () { namespace q = xo::qty::qty; - namespace su = xo::qty::su; + namespace u = xo::qty::u; using xo::qty::with_units_from; using xo::qty::with_units; using xo::qty::quantity; @@ -25,13 +25,13 @@ main () { << ", d.t^-2: " << a << endl; - constexpr auto a2 = a.rescale_ext(); + constexpr auto a2 = a.rescale_ext(); static_assert(a2.abbrev() == flatstring("m.s^-2")); cerr << "a2: " << a2 << endl; - constexpr auto a3 = with_units(a); + constexpr auto a3 = with_units(a); static_assert(a3.abbrev() == flatstring("m.s^-2")); diff --git a/example/ex3/ex3.cpp b/example/ex3/ex3.cpp index c7b45992..30754ffa 100644 --- a/example/ex3/ex3.cpp +++ b/example/ex3/ex3.cpp @@ -7,14 +7,14 @@ int main () { namespace q = xo::qty::qty; - namespace su = xo::qty::su; + namespace u = xo::qty::u; //namespace nu = xo::qty::nu; using xo::qty::quantity; using xo::flatstring; using namespace std; - constexpr quantity t = q::minutes(2); - constexpr quantity d = q::kilometers(2.5); + constexpr quantity t = q::minutes(2); + constexpr quantity d = q::kilometers(2.5); constexpr auto t2 = t*t; constexpr auto a = d / (t*t); diff --git a/example/ex7/ex7.cpp b/example/ex7/ex7.cpp index 2339afa8..7b617176 100644 --- a/example/ex7/ex7.cpp +++ b/example/ex7/ex7.cpp @@ -6,9 +6,8 @@ int main () { - //namespace u = xo::unit::units; using namespace xo::qty; - //namespace su = xo::qty::su; + namespace u = xo::qty::u; namespace q = xo::qty::qty; using namespace std; @@ -23,7 +22,7 @@ main () { /* rescale to not-so-absurd units */ /* kg.m.s^-2 */ - quantity res = qty3.rescale_ext(); + quantity res = qty3.rescale_ext(); /* 2.57958e-10kg.m.s^-2 */ cerr << "res: " << res << endl; diff --git a/include/xo/unit/quantity.hpp b/include/xo/unit/quantity.hpp index ebf5c94c..8d70b8ef 100644 --- a/include/xo/unit/quantity.hpp +++ b/include/xo/unit/quantity.hpp @@ -253,7 +253,7 @@ namespace xo { * static_cast(x.scale()) * static_cast(y.scale())); - return quantity(rr.natural_unit_), + return quantity(rr.natural_unit_), r_repr_type>(r_scale); } @@ -280,7 +280,7 @@ namespace xo { * static_cast(x.scale()) / static_cast(y.scale())); - return quantity(rr.natural_unit_), + return quantity(rr.natural_unit_), r_repr_type>(r_scale); } @@ -427,28 +427,28 @@ namespace xo { // ----- mass ----- template - inline constexpr auto picograms(Repr x) { return quantity(x); } + inline constexpr auto picograms(Repr x) { return quantity(x); } template - inline constexpr auto nanograms(Repr x) { return quantity(x); } + inline constexpr auto nanograms(Repr x) { return quantity(x); } template - inline constexpr auto micrograms(Repr x) { return quantity(x); } + inline constexpr auto micrograms(Repr x) { return quantity(x); } template - inline constexpr auto milligrams(Repr x) { return quantity(x); } + inline constexpr auto milligrams(Repr x) { return quantity(x); } template - inline constexpr auto grams(Repr x) { return quantity(x); } + inline constexpr auto grams(Repr x) { return quantity(x); } /** @brief create a quantity representing @p x kilograms of mass, with compile-time unit representation **/ template - inline constexpr auto kilograms(Repr x) { return quantity(x); } + inline constexpr auto kilograms(Repr x) { return quantity(x); } template - inline constexpr auto tonnes(Repr x) { return quantity(x); } + inline constexpr auto tonnes(Repr x) { return quantity(x); } template - inline constexpr auto kilotonnes(Repr x) { return quantity(x); } + inline constexpr auto kilotonnes(Repr x) { return quantity(x); } template - inline constexpr auto megatonnes(Repr x) { return quantity(x); } + inline constexpr auto megatonnes(Repr x) { return quantity(x); } template - inline constexpr auto gigatonnes(Repr x) { return quantity(x); } + inline constexpr auto gigatonnes(Repr x) { return quantity(x); } /** @brief a quantity representing 1 picogram of mass, with compile-time unit representation **/ static constexpr auto picogram = picograms(1); @@ -472,39 +472,39 @@ namespace xo { // ----- distance ----- template - inline constexpr auto picometers(Repr x) { return quantity(x); } + inline constexpr auto picometers(Repr x) { return quantity(x); } template - inline constexpr auto nanometers(Repr x) { return quantity(x); } + inline constexpr auto nanometers(Repr x) { return quantity(x); } template - inline constexpr auto micrometers(Repr x) { return quantity(x); } + inline constexpr auto micrometers(Repr x) { return quantity(x); } template - inline constexpr auto millimeters(Repr x) { return quantity(x); } + inline constexpr auto millimeters(Repr x) { return quantity(x); } template - inline constexpr auto meters(Repr x) { return quantity(x); } + inline constexpr auto meters(Repr x) { return quantity(x); } template - inline constexpr auto kilometers(Repr x) { return quantity(x); } + inline constexpr auto kilometers(Repr x) { return quantity(x); } template - inline constexpr auto megameters(Repr x) { return quantity(x); } + inline constexpr auto megameters(Repr x) { return quantity(x); } template - inline constexpr auto gigameters(Repr x) { return quantity(x); } + inline constexpr auto gigameters(Repr x) { return quantity(x); } template - inline constexpr auto lightseconds(Repr x) { return quantity(x); } + inline constexpr auto lightseconds(Repr x) { return quantity(x); } template - inline constexpr auto astronomicalunits(Repr x) { return quantity(x); } + inline constexpr auto astronomicalunits(Repr x) { return quantity(x); } /** @brief create quantity representing @p x inches of distance, with compile-time unit representation **/ template - inline constexpr auto inches(Repr x) { return quantity(x); } + inline constexpr auto inches(Repr x) { return quantity(x); } /** @brief create quantity representing @p x feet of distance, with compile-time unit representation **/ template - inline constexpr auto feet(Repr x) { return quantity(x); } + inline constexpr auto feet(Repr x) { return quantity(x); } /** @brief create quantity representing @p x yards of distance, with compile-time unit representation **/ template - inline constexpr auto yards(Repr x) { return quantity(x); } + inline constexpr auto yards(Repr x) { return quantity(x); } /** @brief create quantity representing @p x statute miles of distance, with compile-time unit representation **/ template - inline constexpr auto miles(Repr x) { return quantity(x); } + inline constexpr auto miles(Repr x) { return quantity(x); } /** @brief a quantity representing 1 picometer of distance, with compile-time unit representation **/ static constexpr auto picometer = picometers(1); @@ -534,44 +534,44 @@ namespace xo { // ----- time ----- template - inline constexpr auto picoseconds(Repr x) { return quantity(x); } + inline constexpr auto picoseconds(Repr x) { return quantity(x); } template - inline constexpr auto nanoseconds(Repr x) { return quantity(x); } + inline constexpr auto nanoseconds(Repr x) { return quantity(x); } template - inline constexpr auto microseconds(Repr x) { return quantity(x); } + inline constexpr auto microseconds(Repr x) { return quantity(x); } template - inline constexpr auto milliseconds(Repr x) { return quantity(x); } + inline constexpr auto milliseconds(Repr x) { return quantity(x); } /** @brief create quantity representing @p x seconds of time, with compile-time unit representation **/ template - inline constexpr auto seconds(Repr x) { return quantity(x); } + inline constexpr auto seconds(Repr x) { return quantity(x); } /** @brief create quantity representing @p x minutes of time, with compile-time unit representation **/ template - inline constexpr auto minutes(Repr x) { return quantity(x); } + inline constexpr auto minutes(Repr x) { return quantity(x); } /** @brief create quantity representing @p x hours of time, with compile-time unit representation **/ template - inline constexpr auto hours(Repr x) { return quantity(x); } + inline constexpr auto hours(Repr x) { return quantity(x); } /** @brief create quantity representing @p x days of time, with compile-time unit representation **/ template - inline constexpr auto days(Repr x) { return quantity(x); } + inline constexpr auto days(Repr x) { return quantity(x); } template - inline constexpr auto weeks(Repr x) { return quantity(x); } + inline constexpr auto weeks(Repr x) { return quantity(x); } template - inline constexpr auto months(Repr x) { return quantity(x); } + inline constexpr auto months(Repr x) { return quantity(x); } template - inline constexpr auto years(Repr x) { return quantity(x); } + inline constexpr auto years(Repr x) { return quantity(x); } template - inline constexpr auto year250s(Repr x) { return quantity(x); } + inline constexpr auto year250s(Repr x) { return quantity(x); } template - inline constexpr auto year360s(Repr x) { return quantity(x); } + inline constexpr auto year360s(Repr x) { return quantity(x); } template - inline constexpr auto year365s(Repr x) { return quantity(x); } + inline constexpr auto year365s(Repr x) { return quantity(x); } /** @brief a quantity representing 1 second of time, with compile-time unit representation **/ static constexpr auto second = seconds(1); @@ -591,13 +591,13 @@ namespace xo { */ template - inline constexpr auto volatility_30d(Repr x) { return quantity(x); } + inline constexpr auto volatility_30d(Repr x) { return quantity(x); } template - inline constexpr auto volatility_250d(Repr x) { return quantity(x); } + inline constexpr auto volatility_250d(Repr x) { return quantity(x); } template - inline constexpr auto volatility_360d(Repr x) { return quantity(x); } + inline constexpr auto volatility_360d(Repr x) { return quantity(x); } template - inline constexpr auto volatility_365d(Repr x) { return quantity(x); } + inline constexpr auto volatility_365d(Repr x) { return quantity(x); } } /*namespace qty*/ /* reminder: see [quantity_ops.hpp] for operator* etc */ diff --git a/include/xo/unit/scaled_unit.hpp b/include/xo/unit/scaled_unit.hpp index 4cd5fe80..20f4025f 100644 --- a/include/xo/unit/scaled_unit.hpp +++ b/include/xo/unit/scaled_unit.hpp @@ -56,61 +56,67 @@ namespace xo { namespace detail { template - constexpr auto make_unit_rescale_result(const natural_unit & bpuv) { + constexpr auto su_promote(const natural_unit & bpuv) { return scaled_unit(bpuv, ratio::ratio(1, 1), 1.0); } } - namespace su { - constexpr auto picogram = detail::make_unit_rescale_result(nu::picogram); - constexpr auto nanogram = detail::make_unit_rescale_result(nu::nanogram); - constexpr auto microgram = detail::make_unit_rescale_result(nu::microgram); - constexpr auto milligram = detail::make_unit_rescale_result(nu::milligram); - constexpr auto gram = detail::make_unit_rescale_result(nu::gram); - constexpr auto kilogram = detail::make_unit_rescale_result(nu::kilogram); - constexpr auto tonne = detail::make_unit_rescale_result(nu::tonne); - constexpr auto kilotonne = detail::make_unit_rescale_result(nu::kilotonne); - constexpr auto megatonne = detail::make_unit_rescale_result(nu::megatonne); - constexpr auto gigatonne = detail::make_unit_rescale_result(nu::gigatonne); + namespace u { + /* values here can be used as template arguments to quantity: + * e.g. + * quantity qty1; + * quantity velocity; + */ - constexpr auto picometer = detail::make_unit_rescale_result(nu::picometer); - constexpr auto nanometer = detail::make_unit_rescale_result(nu::nanometer); - constexpr auto micrometer = detail::make_unit_rescale_result(nu::micrometer); - constexpr auto millimeter = detail::make_unit_rescale_result(nu::millimeter); - constexpr auto meter = detail::make_unit_rescale_result(nu::meter); - constexpr auto kilometer = detail::make_unit_rescale_result(nu::kilometer); - constexpr auto megameter = detail::make_unit_rescale_result(nu::megameter); - constexpr auto gigameter = detail::make_unit_rescale_result(nu::gigameter); + constexpr auto picogram = detail::su_promote(nu::picogram); + constexpr auto nanogram = detail::su_promote(nu::nanogram); + constexpr auto microgram = detail::su_promote(nu::microgram); + constexpr auto milligram = detail::su_promote(nu::milligram); + constexpr auto gram = detail::su_promote(nu::gram); + constexpr auto kilogram = detail::su_promote(nu::kilogram); + constexpr auto tonne = detail::su_promote(nu::tonne); + constexpr auto kilotonne = detail::su_promote(nu::kilotonne); + constexpr auto megatonne = detail::su_promote(nu::megatonne); + constexpr auto gigatonne = detail::su_promote(nu::gigatonne); - constexpr auto lightsecond = detail::make_unit_rescale_result(nu::lightsecond); - constexpr auto astronomicalunit = detail::make_unit_rescale_result(nu::astronomicalunit); + constexpr auto picometer = detail::su_promote(nu::picometer); + constexpr auto nanometer = detail::su_promote(nu::nanometer); + constexpr auto micrometer = detail::su_promote(nu::micrometer); + constexpr auto millimeter = detail::su_promote(nu::millimeter); + constexpr auto meter = detail::su_promote(nu::meter); + constexpr auto kilometer = detail::su_promote(nu::kilometer); + constexpr auto megameter = detail::su_promote(nu::megameter); + constexpr auto gigameter = detail::su_promote(nu::gigameter); - constexpr auto inch = detail::make_unit_rescale_result(nu::inch); - constexpr auto foot = detail::make_unit_rescale_result(nu::foot); - constexpr auto yard = detail::make_unit_rescale_result(nu::yard); - constexpr auto mile = detail::make_unit_rescale_result(nu::mile); + constexpr auto lightsecond = detail::su_promote(nu::lightsecond); + constexpr auto astronomicalunit = detail::su_promote(nu::astronomicalunit); - constexpr auto picosecond = detail::make_unit_rescale_result(nu::picosecond); - constexpr auto nanosecond = detail::make_unit_rescale_result(nu::nanosecond); - constexpr auto microsecond = detail::make_unit_rescale_result(nu::microsecond); - constexpr auto millisecond = detail::make_unit_rescale_result(nu::millisecond); - constexpr auto second = detail::make_unit_rescale_result(nu::second); - constexpr auto minute = detail::make_unit_rescale_result(nu::minute); - constexpr auto hour = detail::make_unit_rescale_result(nu::hour); - constexpr auto day = detail::make_unit_rescale_result(nu::day); - constexpr auto week = detail::make_unit_rescale_result(nu::week); - constexpr auto month = detail::make_unit_rescale_result(nu::month); - constexpr auto year = detail::make_unit_rescale_result(nu::year); - constexpr auto year250 = detail::make_unit_rescale_result(nu::year250); - constexpr auto year360 = detail::make_unit_rescale_result(nu::year360); - constexpr auto year365 = detail::make_unit_rescale_result(nu::year365); + constexpr auto inch = detail::su_promote(nu::inch); + constexpr auto foot = detail::su_promote(nu::foot); + constexpr auto yard = detail::su_promote(nu::yard); + constexpr auto mile = detail::su_promote(nu::mile); - constexpr auto volatility_30d = detail::make_unit_rescale_result(nu::volatility_30d); - constexpr auto volatility_250d = detail::make_unit_rescale_result(nu::volatility_250d); - constexpr auto volatility_360d = detail::make_unit_rescale_result(nu::volatility_360d); - constexpr auto volatility_365d = detail::make_unit_rescale_result(nu::volatility_365d); + constexpr auto picosecond = detail::su_promote(nu::picosecond); + constexpr auto nanosecond = detail::su_promote(nu::nanosecond); + constexpr auto microsecond = detail::su_promote(nu::microsecond); + constexpr auto millisecond = detail::su_promote(nu::millisecond); + constexpr auto second = detail::su_promote(nu::second); + constexpr auto minute = detail::su_promote(nu::minute); + constexpr auto hour = detail::su_promote(nu::hour); + constexpr auto day = detail::su_promote(nu::day); + constexpr auto week = detail::su_promote(nu::week); + constexpr auto month = detail::su_promote(nu::month); + constexpr auto year = detail::su_promote(nu::year); + constexpr auto year250 = detail::su_promote(nu::year250); + constexpr auto year360 = detail::su_promote(nu::year360); + constexpr auto year365 = detail::su_promote(nu::year365); + + constexpr auto volatility_30d = detail::su_promote(nu::volatility_30d); + constexpr auto volatility_250d = detail::su_promote(nu::volatility_250d); + constexpr auto volatility_360d = detail::su_promote(nu::volatility_360d); + constexpr auto volatility_365d = detail::su_promote(nu::volatility_365d); } namespace detail { diff --git a/utest/quantity.test.cpp b/utest/quantity.test.cpp index d1033cae..af28575a 100644 --- a/utest/quantity.test.cpp +++ b/utest/quantity.test.cpp @@ -389,7 +389,7 @@ namespace xo { static_assert(rr.outer_scale_factor_.template convert_to() == 1.0); static_assert(rr.natural_unit_.n_bpu() == 1); - constexpr auto q1 = quantity(rr.natural_unit_), + constexpr auto q1 = quantity(rr.natural_unit_), decltype(ms)::repr_type>(ms.scale() * ms.scale()); /* proof that q is constexpr */ @@ -461,7 +461,7 @@ namespace xo { static_assert(rr.outer_scale_factor_.template convert_to() == 1.0); static_assert(rr.natural_unit_.n_bpu() == 0); - constexpr auto q1 = quantity(rr.natural_unit_), + constexpr auto q1 = quantity(rr.natural_unit_), decltype(ms)::repr_type>(ms.scale() * ms.scale()); /* proof that q is constexpr */ diff --git a/utest/scaled_unit.test.cpp b/utest/scaled_unit.test.cpp index 18cae503..898aa485 100644 --- a/utest/scaled_unit.test.cpp +++ b/utest/scaled_unit.test.cpp @@ -75,7 +75,7 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.scaled_unit0")); - constexpr auto ng = su::nanogram; + constexpr auto ng = u::nanogram; constexpr auto ng2 = ng * ng; log && log(xtag("ng", ng)); @@ -90,7 +90,7 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.scaled_unit1")); - constexpr auto ng = su::nanogram; + constexpr auto ng = u::nanogram; constexpr auto ng2 = ng / ng; log && log(xtag("ng", ng)); @@ -105,7 +105,7 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.scaled_unit2")); - constexpr auto ms = su::millisecond; + constexpr auto ms = u::millisecond; constexpr auto ms2 = ms * ms; log && log(xtag("ms", ms)); diff --git a/utest/unit.test.cpp b/utest/unit.test.cpp index 04ba99b2..437e73f7 100644 --- a/utest/unit.test.cpp +++ b/utest/unit.test.cpp @@ -12,7 +12,7 @@ namespace xo { namespace ut { /* compile-time tests */ - namespace su = xo::qty::su; + namespace u = xo::qty::u; using xo::qty::dim; using xo::qty::basis_unit2_abbrev_type; diff --git a/utest/xquantity.test.cpp b/utest/xquantity.test.cpp index 745963b2..5219fca4 100644 --- a/utest/xquantity.test.cpp +++ b/utest/xquantity.test.cpp @@ -12,7 +12,7 @@ #include namespace xo { - namespace su = xo::qty::su; + namespace u = xo::qty::u; namespace nu = xo::qty::nu; using xo::qty::xquantity; @@ -388,7 +388,7 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity")); /* not constexpr until c++26 */ - auto ng = unit_qty(su::nanogram); + auto ng = unit_qty(u::nanogram); log && log(xtag("ng", ng)); @@ -401,7 +401,7 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity2")); /* not constexpr until c++26 */ - xquantity ng = unit_qty(su::nanogram); + xquantity ng = unit_qty(u::nanogram); auto ng2 = ng * ng; log && log(xtag("ng*ng", ng2)); @@ -415,7 +415,7 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity3")); /* not constexpr until c++26 */ - xquantity ng = unit_qty(su::nanogram); + xquantity ng = unit_qty(u::nanogram); auto ng0 = ng / ng; log && log(xtag("ng/ng", ng0)); @@ -429,8 +429,8 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity4")); /* not constexpr until c++26 */ - xquantity ng = unit_qty(su::nanogram); - xquantity ug = unit_qty(su::microgram); + xquantity ng = unit_qty(u::nanogram); + xquantity ug = unit_qty(u::microgram); { auto prod1 = ng * ug; @@ -465,8 +465,8 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity5")); /* not constexpr until c++26 */ - xquantity ng = unit_qty(su::nanogram); - xquantity ug = unit_qty(su::microgram); + xquantity ng = unit_qty(u::nanogram); + xquantity ug = unit_qty(u::microgram); { auto ratio1 = ng / ug; @@ -494,8 +494,8 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity6")); /* not constexpr until c++26 */ - xquantity ng = unit_qty(su::nanogram); - xquantity ug = unit_qty(su::microgram); + xquantity ng = unit_qty(u::nanogram); + xquantity ug = unit_qty(u::microgram); { auto sum1 = ng + ug; @@ -526,8 +526,8 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity7")); /* not constexpr until c++26 */ - xquantity ng = unit_qty(su::nanogram); - xquantity ug = unit_qty(su::microgram); + xquantity ng = unit_qty(u::nanogram); + xquantity ug = unit_qty(u::microgram); { auto sum1 = ng - ug; @@ -558,8 +558,8 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity.compare")); /* not constexpr until c++26 */ - xquantity ng = 1000 * unit_qty(su::nanogram); - xquantity ug = unit_qty(su::microgram); + xquantity ng = 1000 * unit_qty(u::nanogram); + xquantity ug = unit_qty(u::microgram); { auto cmp = (ng == ug); @@ -617,8 +617,8 @@ namespace xo { scope log(XO_DEBUG2(c_debug_flag, "TEST_CASE.xquantity.compare2")); /* not constexpr until c++26 */ - xquantity ng = unit_qty(su::nanogram); - xquantity ug = unit_qty(su::microgram); + xquantity ng = unit_qty(u::nanogram); + xquantity ug = unit_qty(u::microgram); { auto cmp = (ng == ug);