From 765707537f02e5c8e7787153841067ea777e8726 Mon Sep 17 00:00:00 2001
From: Daniel Arndt <arndtd@ornl.gov>
Date: Tue, 21 Mar 2023 17:47:24 -0400
Subject: [PATCH] Fix MatrixIterator comparison operator for C++20

---
 include/deal.II/lac/matrix_iterator.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/deal.II/lac/matrix_iterator.h b/include/deal.II/lac/matrix_iterator.h
index 9374c46bee..cc7cfe1834 100644
--- a/include/deal.II/lac/matrix_iterator.h
+++ b/include/deal.II/lac/matrix_iterator.h
@@ -87,14 +87,16 @@ public:
   /**
    * Comparison. True, if both accessors are equal.
    */
+  template <class OtherAccessor>
   bool
-  operator==(const MatrixIterator &) const;
+  operator==(const MatrixIterator<OtherAccessor> &) const;
 
   /**
    * Inverse of <tt>==</tt>.
    */
+  template <class OtherAccessor>
   bool
-  operator!=(const MatrixIterator &) const;
+  operator!=(const MatrixIterator<OtherAccessor> &) const;
 
   /**
    * Comparison operator. Result is true if either the first row number is
@@ -178,16 +180,20 @@ MatrixIterator<ACCESSOR>::operator->() const
 
 
 template <class ACCESSOR>
+template <class OtherAccessor>
 inline bool
-MatrixIterator<ACCESSOR>::operator==(const MatrixIterator &other) const
+MatrixIterator<ACCESSOR>::operator==(
+  const MatrixIterator<OtherAccessor> &other) const
 {
   return (accessor == other.accessor);
 }
 
 
 template <class ACCESSOR>
+template <class OtherAccessor>
 inline bool
-MatrixIterator<ACCESSOR>::operator!=(const MatrixIterator &other) const
+MatrixIterator<ACCESSOR>::operator!=(
+  const MatrixIterator<OtherAccessor> &other) const
 {
   return !(*this == other);
 }
-- 
2.39.5