fix(gcc9): comparisons

This commit is contained in:
Johel Ernesto Guerrero Peña
2020-05-30 21:53:24 -04:00
committed by Mateusz Pusz
parent 628ccde5f0
commit 764176dcad

View File

@@ -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);
} }