From 4831928802f5336f12ada129384c764ec149d65c Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sun, 1 Dec 2024 14:00:52 +0100 Subject: [PATCH] refactor: `Scalar` concept refactored to give it a chance to preserve the input type for types simliar to `quantity` --- .../include/mp-units/framework/representation_concepts.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/include/mp-units/framework/representation_concepts.h b/src/core/include/mp-units/framework/representation_concepts.h index 384479a7..9bcb0431 100644 --- a/src/core/include/mp-units/framework/representation_concepts.h +++ b/src/core/include/mp-units/framework/representation_concepts.h @@ -75,13 +75,12 @@ template concept WeaklyRegular = std::copyable && std::equality_comparable; template -concept Scalar = (!disable_scalar) && WeaklyRegular && requires(T a, T b) { - // scalar operations +concept Scalar = (!disable_scalar) && WeaklyRegular && requires(T a, T b, T c) { { -a } -> std::common_with; { a + b } -> std::common_with; { a - b } -> std::common_with; - { a* b } -> std::common_with; - { a / b } -> std::common_with; + { a* b / c } -> std::common_with; + { a / b* c } -> std::common_with; }; namespace real_impl {