mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-05 21:24:27 +02:00
fix(gcc9): comparisons
This commit is contained in:
committed by
Mateusz Pusz
parent
628ccde5f0
commit
764176dcad
@@ -138,66 +138,60 @@ public:
|
|||||||
// Below friend functions are to be found via argument-dependent lookup only
|
// Below friend functions are to be found via argument-dependent lookup only
|
||||||
#if __GNUC__ >= 10
|
#if __GNUC__ >= 10
|
||||||
|
|
||||||
template<typename D2, typename U2, typename Rep2>
|
template<QuantityPoint QP>
|
||||||
[[nodiscard]] friend constexpr auto operator<=>(const quantity_point& lhs, const quantity_point<D2, U2, Rep2>& rhs)
|
[[nodiscard]] friend constexpr auto operator<=>(const quantity_point& lhs, const QP& rhs)
|
||||||
requires requires { lhs.q_ <=> rhs.relative(); }
|
requires std::three_way_comparable_with<quantity_type, typename QP::quantity_type>
|
||||||
{
|
{
|
||||||
return lhs.q_ <=> rhs.relative();
|
return lhs.q_ <=> rhs.relative();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename D2, typename U2, typename Rep2>
|
template<QuantityPoint QP>
|
||||||
[[nodiscard]] friend constexpr auto operator==(const quantity_point& lhs, const quantity_point<D2, U2, Rep2>& rhs)
|
[[nodiscard]] friend constexpr auto operator==(const quantity_point& lhs, const QP& rhs)
|
||||||
requires requires { lhs.q_ == rhs.relative(); }
|
requires std::equality_comparable_with<quantity_type, typename QP::quantity_type>
|
||||||
{
|
{
|
||||||
return lhs.q_ == rhs.relative();
|
return lhs.q_ == rhs.relative();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
template<typename D2, typename U2, typename Rep2>
|
template<QuantityPoint QP>
|
||||||
[[nodiscard]] friend constexpr bool operator==(const quantity_point& lhs, const quantity_point<D2, U2, Rep2>& rhs)
|
[[nodiscard]] friend constexpr bool operator==(const quantity_point& lhs, const QP& rhs)
|
||||||
requires equivalent_dim<D, D2> &&
|
requires std::equality_comparable_with<quantity_type, typename QP::quantity_type>
|
||||||
std::equality_comparable_with<Rep, Rep2>
|
|
||||||
{
|
{
|
||||||
return lhs.q_ == rhs.relative();
|
return lhs.q_ == rhs.relative();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename D2, typename U2, typename Rep2>
|
template<QuantityPoint QP>
|
||||||
[[nodiscard]] friend constexpr bool operator!=(const quantity_point& lhs, const quantity_point<D2, U2, Rep2>& rhs)
|
[[nodiscard]] friend constexpr bool operator!=(const quantity_point& lhs, const QP& rhs)
|
||||||
requires equivalent_dim<D, D2> &&
|
requires std::equality_comparable_with<quantity_type, typename QP::quantity_type>
|
||||||
std::equality_comparable_with<Rep, Rep2>
|
|
||||||
{
|
{
|
||||||
return !(lhs == rhs);
|
return !(lhs == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename D2, typename U2, typename Rep2>
|
template<QuantityPoint QP>
|
||||||
[[nodiscard]] friend constexpr bool operator<(const quantity_point& lhs, const quantity_point<D2, U2, Rep2>& rhs)
|
[[nodiscard]] friend constexpr bool operator<(const quantity_point& lhs, const QP& rhs)
|
||||||
requires equivalent_dim<D, D2> &&
|
requires std::totally_ordered_with<quantity_type, typename QP::quantity_type>
|
||||||
std::totally_ordered_with<Rep, Rep2>
|
|
||||||
{
|
{
|
||||||
return lhs.q_ < rhs.relative();
|
return lhs.q_ < rhs.relative();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename D2, typename U2, typename Rep2>
|
template<QuantityPoint QP>
|
||||||
[[nodiscard]] friend constexpr bool operator<=(const quantity_point& lhs, const quantity_point<D2, U2, Rep2>& rhs)
|
[[nodiscard]] friend constexpr bool operator<=(const quantity_point& lhs, const QP& rhs)
|
||||||
requires equivalent_dim<D, D2> &&
|
requires std::totally_ordered_with<quantity_type, typename QP::quantity_type>
|
||||||
std::totally_ordered_with<Rep, Rep2>
|
|
||||||
{
|
{
|
||||||
return !(rhs < lhs);
|
return !(rhs < lhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename D2, typename U2, typename Rep2>
|
template<QuantityPoint QP>
|
||||||
[[nodiscard]] friend constexpr bool operator>(const quantity_point& lhs, const quantity_point<D2, U2, Rep2>& rhs)
|
[[nodiscard]] friend constexpr bool operator>(const quantity_point& lhs, const QP& rhs)
|
||||||
requires equivalent_dim<D, D2> &&
|
requires std::totally_ordered_with<quantity_type, typename QP::quantity_type>
|
||||||
std::totally_ordered_with<Rep, Rep2>
|
|
||||||
{
|
{
|
||||||
return rhs < lhs;
|
return rhs < lhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename D2, typename U2, typename Rep2>
|
template<QuantityPoint QP>
|
||||||
[[nodiscard]] friend constexpr bool operator>=(const quantity_point& lhs, const quantity_point<D2, U2, Rep2>& rhs)
|
[[nodiscard]] friend constexpr bool operator>=(const quantity_point& lhs, const QP& rhs)
|
||||||
requires equivalent_dim<D, D2> &&
|
requires std::totally_ordered_with<quantity_type, typename QP::quantity_type>
|
||||||
std::totally_ordered_with<Rep, Rep2>
|
|
||||||
{
|
{
|
||||||
return !(lhs < rhs);
|
return !(lhs < rhs);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user