diff --git a/src/include/units/concepts.h b/src/include/units/concepts.h index 549c8742..a60a852c 100644 --- a/src/include/units/concepts.h +++ b/src/include/units/concepts.h @@ -80,14 +80,11 @@ struct scaled_unit; // TODO: Remove when P1985 accepted namespace detail { -struct is_derived_from_scaled_unit_impl { - template - static constexpr std::true_type check_base(const scaled_unit&); - static constexpr std::false_type check_base(...); -}; +template +void to_base_scaled_unit(const volatile scaled_unit*); template -inline constexpr bool is_derived_from_scaled_unit = decltype(is_derived_from_scaled_unit_impl::check_base(std::declval()))::value; +concept is_derived_from_scaled_unit = requires { to_base_scaled_unit(std::declval()); }; } // namespace detail @@ -99,20 +96,18 @@ inline constexpr bool is_derived_from_scaled_unit = decltype(is_derived_from_sca template concept Unit = detail::is_derived_from_scaled_unit; +// BaseDimension template requires U::is_named struct base_dimension; namespace detail { -struct is_derived_from_base_dimension_impl { - template - static constexpr std::true_type check_base(const base_dimension&); - static constexpr std::false_type check_base(...); -}; +template +void to_base_base_dimension(const volatile base_dimension*); template -inline constexpr bool is_derived_from_base_dimension = decltype(is_derived_from_base_dimension_impl::check_base(std::declval()))::value; +concept is_derived_from_base_dimension = requires { to_base_base_dimension(std::declval()); }; } // namespace detail