fix: more constraints added to ReferenceOf to provide support for corner cases of dimensionless quantity tree

This commit is contained in:
Mateusz Pusz
2023-06-13 17:34:37 +03:00
parent 8ed82dfe96
commit 74ad0f6f68

View File

@ -74,6 +74,9 @@ template<typename T, auto V>
concept ReferenceOf =
Reference<T> &&
((Dimension<std::remove_const_t<decltype(V)>> && get_quantity_spec(T{}).dimension == V) ||
(QuantitySpec<std::remove_const_t<decltype(V)>> && implicitly_convertible(get_quantity_spec(T{}), V)));
(QuantitySpec<std::remove_const_t<decltype(V)>> && implicitly_convertible(get_quantity_spec(T{}), V) &&
!detail::DerivedFromQuantityKindSpecOf<get_quantity_spec(T{}), V> &&
(detail::QuantityKindSpec<std::remove_const_t<decltype(get_quantity_spec(T{}))>> ||
!detail::DerivedFromQuantityKindSpecOf<V, get_quantity_spec(T{})>)));
} // namespace mp_units