forked from mpusz/mp-units
added inheritance unit-test and made is_quantity<T> more specific
This commit is contained in:
committed by
Mateusz Pusz
parent
95ac869522
commit
8e1539bf22
@@ -269,7 +269,7 @@ concept Reference = detail::is_reference<T>;
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_quantity = requires { typename T::dimension; typename T::unit; typename T::rep;};
|
||||
inline constexpr bool is_quantity = false;
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_quantity_point = false;
|
||||
|
||||
@@ -460,6 +460,17 @@ namespace detail {
|
||||
template<typename D, typename U, typename Rep>
|
||||
inline constexpr bool is_quantity<quantity<D, U, Rep>> = true;
|
||||
|
||||
template<typename T>
|
||||
requires units::is_derived_from_specialization_of<T, units::quantity> &&
|
||||
requires {
|
||||
typename T::dimension;
|
||||
typename T::unit;
|
||||
typename T::rep;
|
||||
requires Dimension<typename T::dimension>;
|
||||
requires Unit<typename T::unit>;
|
||||
requires Representation<typename T::rep>; }
|
||||
inline constexpr bool is_quantity<T> = true;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace units
|
||||
|
||||
Reference in New Issue
Block a user