From d6fba478b91f9a084d281c6bbd53caa9e555edec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Tue, 8 Sep 2020 20:50:11 -0400 Subject: [PATCH] feat: working dimension concepts with UNITS_DOWNCAST OFF continuation of https://github.com/johelegp/units-1/commit/22e6107d0f363d894dcef98dd427e4004ac88f30 --- src/include/units/physical/dimensions.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/include/units/physical/dimensions.h b/src/include/units/physical/dimensions.h index f23859f5..2b3b1ffa 100644 --- a/src/include/units/physical/dimensions.h +++ b/src/include/units/physical/dimensions.h @@ -24,16 +24,25 @@ #include #include +#include #include #include namespace units::physical { +namespace detail { + +template typename DimTemplate, typename Child, Unit U, Exponent... Es> + requires requires { typename DimTemplate; } +void to_base_derived_dimension_of(const volatile derived_dimension*); + +} // namespace detail + template typename DimTemplate> -concept DimensionOf = Dimension && is_derived_from_specialization_of; +concept DimensionOf = Dimension && (is_derived_from_specialization_of || requires(const volatile Dim* x) { detail::to_base_derived_dimension_of(x); }); template typename DimTemplate> -concept QuantityOf = Quantity && is_derived_from_specialization_of; +concept QuantityOf = Quantity && DimensionOf; // ------------------------ base dimensions -----------------------------