5 Quantities and units library [quantities]

5.6 Quantity [qty]

5.6.12 Comparison [qty.cmp]

In the following descriptions, let @ be the operator.
template<std::derived_from<quantity> Q, auto R2, typename Rep2> requires see below friend constexpr bool operator==(const Q& lhs, const quantity<R2, Rep2>& rhs); template<std::derived_from<quantity> Q, auto R2, typename Rep2> requires see below friend constexpr auto operator<=>(const Q& lhs, const quantity<R2, Rep2>& rhs);
Let C be std​::​equality_comparable if @ is ==, and std​::​three_way_comparable if @ is <=>.
Effects: Equivalent to: using ct = std::common_type_t<quantity, quantity<R2, Rep2>>; const ct ct_lhs(lhs); const ct ct_rhs(rhs); return ct_lhs.numerical_value_ref_in(ct::unit) @ ct_rhs.numerical_value_ref_in(ct::unit);
Remarks: The expression in the requires-clause is equivalent to: requires { typename std::common_type_t<quantity, quantity<R2, Rep2>>; } && C<typename std::common_type_t<quantity, quantity<R2, Rep2>>::rep>
template<std::derived_from<quantity> Q, Representation Value> requires see below friend constexpr bool operator==(const Q& lhs, const Value& rhs); template<std::derived_from<quantity> Q, Representation Value> requires see below friend constexpr auto operator<=>(const Q& lhs, const Value& rhs);
Let C be std​::​equality_comparable_with if @ is ==, and std​::​three_way_comparable_with if @ is <=>.
Returns: lhs.numerical_value_ref_in(unit) @ rhs.
Remarks: The expression in the requires-clause is equivalent to: (Q::unit == ::mp_units::one) && C<Rep, Value>