refactor: 💥 ReferenceOf does not take a dimension anymore

It seems unneeded and removing this check greatly simplifies common compilation errors.
This commit is contained in:
Mateusz Pusz committed 2024-01-19 10:35:32 +01:00
1 parent 81871bfd4c
commit b4f07f6e7c
5 files changed
+27 -43

No files matched your search

@@ -52,13 +52,13 @@ template<typename T>
concept Quantity = detail::is_derived_from_specialization_of_quantity<T>;
/**
* @brief A concept matching all quantities with provided dimension or quantity spec
* @brief A concept matching all quantities with provided quantity spec
*
* Satisfied by all quantities with a dimension/quantity_spec being the instantiation derived from
* the provided dimension/quantity_spec type.
* Satisfied by all quantities with a quantity_spec being the instantiation derived from
* the provided quantity_spec type.
*/
template<typename Q, auto V>
concept QuantityOf = Quantity<Q> && ReferenceOf<std::remove_const_t<decltype(Q::reference)>, V>;
template<typename Q, auto QS>
concept QuantityOf = Quantity<Q> && QuantitySpecOf<std::remove_const_t<decltype(Q::quantity_spec)>, QS>;
/**
* @brief A concept matching all external quantities like types
@@ -145,15 +145,15 @@ concept SameAbsolutePointOriginAs =
/**
* @brief A concept matching all quantity points with provided dimension or quantity spec
* @brief A concept matching all quantity points with provided quantity spec
*
* Satisfied by all quantity points with a dimension/quantity_spec being the instantiation derived from
* the provided dimension/quantity_spec type, or quantity points having the origin with the same
* Satisfied by all quantity points with a quantity_spec being the instantiation derived from
* the provided quantity_spec type, or quantity points having the origin with the same
* `absolute_point_origin`.
*/
template<typename QP, auto V>
concept QuantityPointOf =
QuantityPoint<QP> && (ReferenceOf<std::remove_const_t<decltype(QP::reference)>, V> ||
QuantityPoint<QP> && (QuantitySpecOf<std::remove_const_t<decltype(QP::quantity_spec)>, V> ||
detail::SameAbsolutePointOriginAs<std::remove_const_t<decltype(QP::absolute_point_origin)>, V>);
/**
@@ -66,14 +66,12 @@ template<auto Q, auto U>
}
/**
* @brief A concept matching all references with provided dimension or quantity spec
* @brief A concept matching all references with provided quantity spec
*
* Satisfied by all references with a dimension/quantity_spec being the instantiation derived from
* the provided dimension/quantity_spec type.
* Satisfied by all references with a quantity_spec being the instantiation derived from
* the provided quantity_spec type.
*/
template<typename T, auto V>
concept ReferenceOf =
Reference<T> && (DimensionOf<std::remove_const_t<decltype(get_quantity_spec(T{}).dimension)>, V> ||
QuantitySpecOf<std::remove_const_t<decltype(get_quantity_spec(T{}))>, V>);
template<typename T, auto QS>
concept ReferenceOf = Reference<T> && QuantitySpecOf<std::remove_const_t<decltype(get_quantity_spec(T{}))>, QS>;
} // namespace mp_units