fix: ValuePreservingTo fixed to apply std::remove_cvref_t on FromRep

This commit is contained in:
Mateusz Pusz
2024-10-26 19:11:10 +02:00
parent 8b46723fe2
commit 2a1edbe47a

View File

@@ -63,9 +63,11 @@ template<typename T>
concept IsFloatingPoint = treat_as_floating_point<T>; concept IsFloatingPoint = treat_as_floating_point<T>;
template<typename FromRep, typename ToRep, auto FromUnit = one, auto ToUnit = one> template<typename FromRep, typename ToRep, auto FromUnit = one, auto ToUnit = one>
concept ValuePreservingTo = requires(FromRep&& from, ToRep to) { concept ValuePreservingTo =
{ to = std::forward<FromRep>(from) } -> std::same_as<ToRep&>; requires(FromRep&& from, ToRep to) {
} && (IsFloatingPoint<ToRep> || (!IsFloatingPoint<FromRep> && (integral_conversion_factor(FromUnit, ToUnit)))); { to = std::forward<FromRep>(from) } -> std::same_as<ToRep&>;
} && (IsFloatingPoint<ToRep> ||
(!IsFloatingPoint<std::remove_cvref_t<FromRep>> && (integral_conversion_factor(FromUnit, ToUnit))));
template<typename QFrom, typename QTo> template<typename QFrom, typename QTo>
concept QuantityConvertibleTo = concept QuantityConvertibleTo =