From ef389dadd4f082e13b076f14a123bf506e158da4 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Wed, 8 Apr 2020 16:51:59 +0100 Subject: libstdc++: Add comparison operators to types from Numerics clause Some more C++20 changes from P1614R2, "The Mothership has Landed". * include/bits/slice_array.h (operator==(const slice&, const slice&)): Define for C++20. * include/std/complex (operator==(const T&, const complex<T>&)) (operator!=(const complex<T>&, const complex<T>&)) (operator!=(const complex<T>&, const T&)) (operator!=(const T&, const complex<T>&)): Do not declare for C++20. * testsuite/26_numerics/slice/compare.cc: New test. --- libstdc++-v3/include/std/complex | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libstdc++-v3/include/std/complex') diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 4f170dc..f2917b8 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -468,6 +468,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator==(const complex<_Tp>& __x, const _Tp& __y) { return __x.real() == __y && __x.imag() == _Tp(); } +#if !(__cpp_impl_three_way_comparison >= 201907L) template<typename _Tp> inline _GLIBCXX_CONSTEXPR bool operator==(const _Tp& __x, const complex<_Tp>& __y) @@ -490,6 +491,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _GLIBCXX_CONSTEXPR bool operator!=(const _Tp& __x, const complex<_Tp>& __y) { return __x != __y.real() || _Tp() != __y.imag(); } +#endif //@} /// Extraction operator for complex values. -- cgit v1.1