mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-07 14:14:27 +02:00
feat: quantity_equivalent_to
concept added
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user