From 764e211f9a3479512c24b30d25bf6fb395f1f2fe Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 3 Feb 2023 16:52:17 +0100 Subject: [PATCH] fix: perfect forwarding of a number in the reference multiply operator fixed --- src/core/include/mp_units/reference.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/include/mp_units/reference.h b/src/core/include/mp_units/reference.h index f03091b9..96fc5d25 100644 --- a/src/core/include/mp_units/reference.h +++ b/src/core/include/mp_units/reference.h @@ -158,10 +158,11 @@ template return {}; } -template Rep> -[[nodiscard]] constexpr quantity operator*(Rep&& lhs, R) +template + requires RepresentationOf, get_quantity_spec(R{}).character> +[[nodiscard]] constexpr quantity> operator*(Rep&& lhs, R) { - return quantity(std::forward(lhs)); + return quantity>(std::forward(lhs)); } void /*Use `q * (1 * r)` rather than `q * r`.*/ operator*(Quantity auto, Reference auto) = delete;