[llvm-branch-commits] [llvm] 1445f34 - Revert "[STLExtras] Remove incorrect hack to make indexed_accessor_range operator== compatible with C++20 (#72220)"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 14 07:06:26 PST 2023


Author: Utkarsh Saxena
Date: 2023-11-14T16:06:21+01:00
New Revision: 1445f344331e145566c9fae801b096e651966460

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

LOG: Revert "[STLExtras] Remove incorrect hack to make indexed_accessor_range operator== compatible with C++20 (#72220)"

This reverts commit 2be3fcab0e792d934698d5f6af7b7e17d8848ca4.

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 e42b0e8d1b27b71..18bc4d108b156bf 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -1291,11 +1291,15 @@ class indexed_accessor_range_base {
   }
 
   /// Compare this range with another.
-  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);
+  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);
   }
 
   /// Return the size of this range.


        


More information about the llvm-branch-commits mailing list