From 4fb1bc4f359c2fcec384fd32da89ac45f0bf2723 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 29 Dec 2025 18:24:17 +0100 Subject: [PATCH] refactor: `quantity_cast` constraints improved --- src/core/include/mp-units/framework/quantity_cast.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/include/mp-units/framework/quantity_cast.h b/src/core/include/mp-units/framework/quantity_cast.h index 018317eb1..276073e55 100644 --- a/src/core/include/mp-units/framework/quantity_cast.h +++ b/src/core/include/mp-units/framework/quantity_cast.h @@ -58,7 +58,8 @@ namespace mp_units { * @tparam ToQS a quantity specification to use for a target quantity */ template> - requires(castable(Q::quantity_spec, ToQS)) && (MP_UNITS_WEAK_UNIT_OF(MP_UNITS_NONCONST_TYPE(Q::unit), ToQS)) + requires(castable(Q::quantity_spec, ToQS)) && + requires { typename quantity; } [[nodiscard]] constexpr Quantity auto quantity_cast(FwdQ&& q) { return quantity{std::forward(q).numerical_value_is_an_implementation_detail_, make_reference(ToQS, Q::unit)};