[libcxx-commits] [libcxx] cdcfc5e - [libc++][regex] Removes operator!=.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 19 08:02:04 PDT 2023


Author: Mark de Wever
Date: 2023-06-19T17:01:56+02:00
New Revision: cdcfc5ec9b33da441218041b6cd4f4ad19620eca

URL: https://github.com/llvm/llvm-project/commit/cdcfc5ec9b33da441218041b6cd4f4ad19620eca
DIFF: https://github.com/llvm/llvm-project/commit/cdcfc5ec9b33da441218041b6cd4f4ad19620eca.diff

LOG: [libc++][regex] Removes operator!=.

Implements part of:
- P1614R2 The Mothership has Landed

Reviewed By: #libc, H-G-Hristov, philnik

Differential Revision: https://reviews.llvm.org/D153222

Added: 
    

Modified: 
    libcxx/docs/Status/SpaceshipProjects.csv
    libcxx/include/regex
    libcxx/modules/std/regex.cppm
    libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp
    libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp
    libcxx/test/std/re/re.results/re.results.nonmember/equal.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv
index 86ce5d9387a3f..17f9f92d67440 100644
--- a/libcxx/docs/Status/SpaceshipProjects.csv
+++ b/libcxx/docs/Status/SpaceshipProjects.csv
@@ -188,13 +188,13 @@ Section,Description,Dependencies,Assignee,Complete
 "| `[fs.class.directory.entry] <https://wg21.link/fs.class.directory.entry>`_
 | `[fs.dir.entry.obs] <https://wg21.link/fs.dir.entry.obs>`_",| `filesystem::directory_entry <https://reviews.llvm.org/D130860>`_,None,Adrian Vogelsgesang,|Complete|
 - `5.15 Clause 30: Regular expressions library <https://wg21.link/p1614r2#clause-30-regular-expressions-library>`_,,,,
-| `[re.syn] <https://wg21.link/re.syn>`_,|,None,Mark de Wever,|In Progress|
+| `[re.syn] <https://wg21.link/re.syn>`_,|,None,Mark de Wever,|Complete|
 | `[re.submatch.op] <https://wg21.link/re.submatch.op>`_,| `sub_match <https://reviews.llvm.org/D132310>`_,None,Mark de Wever,|Complete|
-| `[re.results.nonmember] <https://wg21.link/re.results.nonmember>`_,| remove ops `match_results`,None,Mark de Wever,|In Progress|
+| `[re.results.nonmember] <https://wg21.link/re.results.nonmember>`_,| remove ops `match_results`,None,Mark de Wever,|Complete|
 "| `[re.regiter] <https://wg21.link/re.regiter>`_,
-| `[re.regiter.comp] <https://wg21.link/re.regiter.comp>`_",| remove ops `regex_iterator`,None,Mark de Wever,|In Progress|
+| `[re.regiter.comp] <https://wg21.link/re.regiter.comp>`_",| remove ops `regex_iterator`,None,Mark de Wever,|Complete|
 "| `[re.tokiter] <https://wg21.link/re.tokiter>`_
-| `[re.tokiter.comp] <https://wg21.link/re.tokiter.comp>`_",| remove ops `regex_token_iterator`,None,Mark de Wever,|In Progress|
+| `[re.tokiter.comp] <https://wg21.link/re.tokiter.comp>`_",| remove ops `regex_token_iterator`,None,Mark de Wever,|Complete|
 - `5.16 Clause 31: Atomic operations library <https://wg21.link/p1614r2#clause-31-atomic-operations-library>`_,,,,
 - `5.17 Clause 32: Thread support library <https://wg21.link/p1614r2#clause-32-thread-support-library>`_,,,,
 | `[thread.thread.id] <https://wg21.link/thread.thread.id>`_,| `thread::id <https://reviews.llvm.org/D131362>`_,None,Adrian Vogelsgesang,|Complete|

diff  --git a/libcxx/include/regex b/libcxx/include/regex
index b4545580163ba..ea2711fddafca 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -543,7 +543,7 @@ template <class BidirectionalIterator, class Allocator>
     operator==(const match_results<BidirectionalIterator, Allocator>& m1,
                const match_results<BidirectionalIterator, Allocator>& m2);
 
-template <class BidirectionalIterator, class Allocator>
+template <class BidirectionalIterator, class Allocator>                    // Removed in C++20
     bool
     operator!=(const match_results<BidirectionalIterator, Allocator>& m1,
                const match_results<BidirectionalIterator, Allocator>& m2);
@@ -710,7 +710,7 @@ public:
     regex_iterator& operator=(const regex_iterator&);
 
     bool operator==(const regex_iterator&) const;
-    bool operator!=(const regex_iterator&) const;
+    bool operator!=(const regex_iterator&) const;                                // Removed in C++20
 
     const value_type& operator*() const;
     const value_type* operator->() const;
@@ -768,7 +768,7 @@ public:
     regex_token_iterator& operator=(const regex_token_iterator&);
 
     bool operator==(const regex_token_iterator&) const;
-    bool operator!=(const regex_token_iterator&) const;
+    bool operator!=(const regex_token_iterator&) const;                  // Removed in C++20
 
     const value_type& operator*() const;
     const value_type* operator->() const;
@@ -5816,6 +5816,7 @@ operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
            __x.__suffix_ == __y.__suffix_;
 }
 
+#if _LIBCPP_STD_VER < 20
 template <class _BidirectionalIterator, class _Allocator>
 inline _LIBCPP_INLINE_VISIBILITY
 bool
@@ -5824,6 +5825,7 @@ operator!=(const match_results<_BidirectionalIterator, _Allocator>& __x,
 {
     return !(__x == __y);
 }
+#endif
 
 template <class _BidirectionalIterator, class _Allocator>
 inline _LIBCPP_INLINE_VISIBILITY
@@ -6427,8 +6429,10 @@ public:
 #endif
 
     bool operator==(const regex_iterator& __x) const;
+#if _LIBCPP_STD_VER < 20
     _LIBCPP_INLINE_VISIBILITY
     bool operator!=(const regex_iterator& __x) const {return !(*this == __x);}
+#endif
 
     _LIBCPP_INLINE_VISIBILITY
     reference operator*() const {return  __match_;}
@@ -6606,7 +6610,9 @@ public:
 
     bool operator==(const regex_token_iterator& __x) const;
     _LIBCPP_INLINE_VISIBILITY
+#if _LIBCPP_STD_VER < 20
     bool operator!=(const regex_token_iterator& __x) const {return !(*this == __x);}
+#endif
 
     _LIBCPP_INLINE_VISIBILITY
     const value_type& operator*() const {return *__result_;}

diff  --git a/libcxx/modules/std/regex.cppm b/libcxx/modules/std/regex.cppm
index 222ebf94a78a8..7c23e6309c501 100644
--- a/libcxx/modules/std/regex.cppm
+++ b/libcxx/modules/std/regex.cppm
@@ -64,9 +64,6 @@ export namespace std {
   // [re.submatch.op], sub_match non-member operators
   using std::operator==;
   using std::operator<=>;
-#  if 1 // P1614
-  using std::operator!=;
-#  endif
 
   using std::operator<<;
 

diff  --git a/libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp
index f7f71bc8b7c5a..80f6aa3c75051 100644
--- a/libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp
+++ b/libcxx/test/std/re/re.iter/re.regiter/re.regiter.comp/tested_elsewhere.pass.cpp
@@ -11,7 +11,7 @@
 // class regex_iterator<BidirectionalIterator, charT, traits>
 
 // bool operator==(const regex_iterator& right) const;
-// bool operator!=(const regex_iterator& right) const;
+// bool operator!=(const regex_iterator& right) const; // generated by the compiler in C++20
 
 int main(int, char**)
 {

diff  --git a/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp b/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp
index 1c602010319e8..7ccb700c1d182 100644
--- a/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp
+++ b/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.comp/equal.pass.cpp
@@ -11,7 +11,7 @@
 // class regex_token_iterator<BidirectionalIterator, charT, traits>
 
 // bool operator==(const regex_token_iterator& right) const;
-// bool operator!=(const regex_token_iterator& right) const;
+// bool operator!=(const regex_token_iterator& right) const; // generated by the compiler in C++20
 
 #include <regex>
 #include <cassert>

diff  --git a/libcxx/test/std/re/re.results/re.results.nonmember/equal.pass.cpp b/libcxx/test/std/re/re.results/re.results.nonmember/equal.pass.cpp
index 3723ad4740f47..1f01e95861fbc 100644
--- a/libcxx/test/std/re/re.results/re.results.nonmember/equal.pass.cpp
+++ b/libcxx/test/std/re/re.results/re.results.nonmember/equal.pass.cpp
@@ -15,7 +15,7 @@
 //    operator==(const match_results<BidirectionalIterator, Allocator>& m1,
 //               const match_results<BidirectionalIterator, Allocator>& m2);
 
-// template <class BidirectionalIterator, class Allocator>
+// template <class BidirectionalIterator, class Allocator> // generated by the compiler in C++20
 //    bool
 //    operator!=(const match_results<BidirectionalIterator, Allocator>& m1,
 //               const match_results<BidirectionalIterator, Allocator>& m2);


        


More information about the libcxx-commits mailing list