From 05ed7dae88e6c0b3201e86585738664742c68879 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 8 Jun 2023 17:40:01 +0200 Subject: [PATCH] feat: `RepSafeConstructibleFrom` now accounts for magnitude representation type --- src/core/include/mp-units/quantity.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/include/mp-units/quantity.h b/src/core/include/mp-units/quantity.h index 0bc104ae..748d9efc 100644 --- a/src/core/include/mp-units/quantity.h +++ b/src/core/include/mp-units/quantity.h @@ -46,9 +46,10 @@ namespace detail { template using quantity_like_type = quantity::reference, typename quantity_like_traits::rep>; -template +template concept RepSafeConstructibleFrom = - std::constructible_from && (treat_as_floating_point || !treat_as_floating_point); + Unit> && std::constructible_from && + (treat_as_floating_point || (!treat_as_floating_point && is_rational(get_canonical_unit(U).mag))); template concept IntegralConversionFactor = Unit && Unit &&