* [PATCH] libstdc++: remove redundant equality operators
@ 2019-11-06 17:52 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2019-11-06 17:52 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
Now that operator<=> is supported, these operators can be generated by
the compiler.
* include/bits/iterator_concepts.h (unreachable_sentinel_t): Remove
redundant equality operators.
* testsuite/util/testsuite_iterators.h (test_range::sentinel):
Likewise.
Tested powerpc64le-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2242 bytes --]
commit f11a631b97047ef97d7658ca6aebeb392d55f2b3
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Nov 6 00:53:23 2019 +0000
libstdc++: remove redundant equality operators
Now that operator<=> is supported, these operators can be generated by
the compiler.
* include/bits/iterator_concepts.h (unreachable_sentinel_t): Remove
redundant equality operators.
* testsuite/util/testsuite_iterators.h (test_range::sentinel):
Likewise.
diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h
index e30645e05cf..8b398616a56 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -797,23 +797,6 @@ namespace ranges
friend constexpr bool
operator==(unreachable_sentinel_t, const _It&) noexcept
{ return false; }
-
-#ifndef __cpp_lib_three_way_comparison
- template<weakly_incrementable _It>
- friend constexpr bool
- operator!=(unreachable_sentinel_t, const _It&) noexcept
- { return true; }
-
- template<weakly_incrementable _It>
- friend constexpr bool
- operator==(const _It&, unreachable_sentinel_t) noexcept
- { return false; }
-
- template<weakly_incrementable _It>
- friend constexpr bool
- operator!=(const _It&, unreachable_sentinel_t) noexcept
- { return true; }
-#endif
};
inline constexpr unreachable_sentinel_t unreachable_sentinel{};
diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h b/libstdc++-v3/testsuite/util/testsuite_iterators.h
index d20257c1b31..4c5e9a3cc1d 100644
--- a/libstdc++-v3/testsuite/util/testsuite_iterators.h
+++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h
@@ -677,15 +677,6 @@ namespace __gnu_test
friend bool operator==(const sentinel& s, const I& i)
{ return s.end == i.ptr; }
-
- friend bool operator!=(const sentinel& s, const I& i)
- { return !(s == i); }
-
- friend bool operator==(const I& i, const sentinel& s)
- { return s == i; }
-
- friend bool operator!=(const I& i, const sentinel& s)
- { return !(s == i); }
};
auto
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-06 17:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 17:52 [PATCH] libstdc++: remove redundant equality operators Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).