[llvm] e558be5 - [STLExtras] Undo C++20 hack

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 03:48:33 PDT 2023


Author: Benjamin Kramer
Date: 2023-10-23T12:46:35+02:00
New Revision: e558be51bab051d1471d92e967f8a2aecc13567a

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

LOG: [STLExtras] Undo C++20 hack

c312f025940d79b858166b80c50526558864d54e worked around a bug here, but
that has since been fixed in 47747da6340b00e301d3656f95ecf9b04a6ec2bb

Added: 
    

Modified: 
    llvm/include/llvm/ADT/STLExtras.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index d0b79fa91c03130..fade92d458675f2 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -1291,15 +1291,11 @@ class indexed_accessor_range_base {
   }
 
   /// Compare this range with another.
-  template <typename OtherT>
-  friend bool operator==(const indexed_accessor_range_base &lhs,
-                         const OtherT &rhs) {
-    return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
-  }
-  template <typename OtherT>
-  friend bool operator!=(const indexed_accessor_range_base &lhs,
-                         const OtherT &rhs) {
-    return !(lhs == rhs);
+  template <typename OtherT> bool operator==(const OtherT &rhs) const {
+    return std::equal(begin(), end(), rhs.begin(), rhs.end());
+  }
+  template <typename OtherT> bool operator!=(const OtherT &rhs) const {
+    return !(*this == rhs);
   }
 
   /// Return the size of this range.


        


More information about the llvm-commits mailing list