[llvm-branch-commits] [libc] 23d6e75 - Revert "[libc] Add reverse_iterator comparisons (#86147)"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Mar 21 12:36:52 PDT 2024


Author: Guillaume Chatelet
Date: 2024-03-21T20:36:49+01:00
New Revision: 23d6e752ecc1d5a6eecb41a4b8fbfc89a65d2c7b

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

LOG: Revert "[libc] Add reverse_iterator comparisons (#86147)"

This reverts commit c96b61adc33b9d4ab26e2d0e4bce929b31c48768.

Added: 
    

Modified: 
    libc/src/__support/CPP/iterator.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/CPP/iterator.h b/libc/src/__support/CPP/iterator.h
index 4d06e181bcf064..c5bfb1912c7b74 100644
--- a/libc/src/__support/CPP/iterator.h
+++ b/libc/src/__support/CPP/iterator.h
@@ -20,7 +20,6 @@ namespace cpp {
 template <typename T> struct iterator_traits;
 template <typename T> struct iterator_traits<T *> {
   using reference = T &;
-  using value_type = T;
 };
 
 template <typename Iter> class reverse_iterator {
@@ -28,8 +27,6 @@ template <typename Iter> class reverse_iterator {
 
 public:
   using reference = typename iterator_traits<Iter>::reference;
-  using value_type = typename iterator_traits<Iter>::value_type;
-  using iterator_type = Iter;
 
   LIBC_INLINE reverse_iterator() : current() {}
   LIBC_INLINE constexpr explicit reverse_iterator(Iter it) : current(it) {}
@@ -41,38 +38,6 @@ template <typename Iter> class reverse_iterator {
   LIBC_INLINE constexpr explicit reverse_iterator(const Other &it)
       : current(it) {}
 
-  LIBC_INLINE friend constexpr bool operator==(const reverse_iterator &lhs,
-                                               const reverse_iterator &rhs) {
-    return lhs.base() == rhs.base();
-  }
-
-  LIBC_INLINE friend constexpr bool operator!=(const reverse_iterator &lhs,
-                                               const reverse_iterator &rhs) {
-    return lhs.base() != rhs.base();
-  }
-
-  LIBC_INLINE friend constexpr bool operator<(const reverse_iterator &lhs,
-                                              const reverse_iterator &rhs) {
-    return lhs.base() > rhs.base();
-  }
-
-  LIBC_INLINE friend constexpr bool operator<=(const reverse_iterator &lhs,
-                                               const reverse_iterator &rhs) {
-    return lhs.base() >= rhs.base();
-  }
-
-  LIBC_INLINE friend constexpr bool operator>(const reverse_iterator &lhs,
-                                              const reverse_iterator &rhs) {
-    return lhs.base() < rhs.base();
-  }
-
-  LIBC_INLINE friend constexpr bool operator>=(const reverse_iterator &lhs,
-                                               const reverse_iterator &rhs) {
-    return lhs.base() <= rhs.base();
-  }
-
-  LIBC_INLINE constexpr iterator_type base() const { current; }
-
   LIBC_INLINE constexpr reference operator*() const {
     Iter tmp = current;
     return *--tmp;


        


More information about the llvm-branch-commits mailing list