From 5ab79f0c63f58c057ed9c9bf33e800f903618458 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Wed, 9 Nov 2022 22:50:54 -1000 Subject: [PATCH] feat: `quantity_equivalent_to` concept added --- src/core/include/units/concepts.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/core/include/units/concepts.h b/src/core/include/units/concepts.h index 8a7d8e2e..afdfeb4f 100644 --- a/src/core/include/units/concepts.h +++ b/src/core/include/units/concepts.h @@ -110,9 +110,17 @@ inline constexpr bool is_quantity> = true; * Satisfied by all quantities with a dimension being the instantiation derived from * the provided dimension type. */ -template -concept quantity_of = Quantity && ((Dimension> && Q::dimension == V) || - (Reference> && Q::dimension == V.dimension && - Q::unit == V.unit)); +template +concept quantity_of = Quantity && Dimension> && (Q::dimension == D); + +/** + * @brief A concept matching all quantities with provided dimension or reference + * + * Satisfied by all quantities with a dimension being the instantiation derived from + * the provided dimension type. + */ +template +concept quantity_equivalent_to = Quantity && Dimension> && + (interconvertible(Q::dimension, D)); } // namespace units