feat: quantity_equivalent_to concept added

This commit is contained in:
Mateusz Pusz
2022-11-09 22:50:54 -10:00
parent 411f7a0bb7
commit 5ab79f0c63

View File

@@ -110,9 +110,17 @@ inline constexpr bool is_quantity<quantity<R, Rep>> = true;
* Satisfied by all quantities with a dimension being the instantiation derived from * Satisfied by all quantities with a dimension being the instantiation derived from
* the provided dimension type. * the provided dimension type.
*/ */
template<typename Q, auto V> template<typename Q, Dimension auto D>
concept quantity_of = Quantity<Q> && ((Dimension<std::remove_const_t<decltype(V)>> && Q::dimension == V) || concept quantity_of = Quantity<Q> && Dimension<std::remove_const_t<decltype(D)>> && (Q::dimension == D);
(Reference<std::remove_const_t<decltype(V)>> && Q::dimension == V.dimension &&
Q::unit == V.unit)); /**
* @brief A concept matching all quantities with provided dimension or reference
*
* Satisfied by all quantities with a dimension being the instantiation derived from
* the provided dimension type.
*/
template<typename Q, Dimension auto D>
concept quantity_equivalent_to = Quantity<Q> && Dimension<std::remove_const_t<decltype(D)>> &&
(interconvertible(Q::dimension, D));
} // namespace units } // namespace units