]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix ambiguity for TrilinosWrappers::Iterators comparison operators using C++20 15405/head
authorDaniel Arndt <arndtd@ornl.gov>
Tue, 20 Jun 2023 22:25:55 +0000 (18:25 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Tue, 20 Jun 2023 22:26:16 +0000 (18:26 -0400)
include/deal.II/lac/trilinos_sparse_matrix.h

index bf622d84a0b4298980465a810eba5b0c38e7ecc5..90d38d138e8750cb5b9771f70817fd79a8facf25 100644 (file)
@@ -415,28 +415,32 @@ namespace TrilinosWrappers
        * Comparison. True, if both iterators point to the same matrix
        * position.
        */
+      template <bool OtherConstness>
       bool
-      operator==(const Iterator<Constness> &) const;
+      operator==(const Iterator<OtherConstness> &) const;
 
       /**
        * Inverse of <tt>==</tt>.
        */
+      template <bool OtherConstness>
       bool
-      operator!=(const Iterator<Constness> &) const;
+      operator!=(const Iterator<OtherConstness> &) const;
 
       /**
        * Comparison operator. Result is true if either the first row number is
        * smaller or if the row numbers are equal and the first index is
        * smaller.
        */
+      template <bool OtherConstness>
       bool
-      operator<(const Iterator<Constness> &) const;
+      operator<(const Iterator<OtherConstness> &) const;
 
       /**
        * Comparison operator. The opposite of the previous operator
        */
+      template <bool OtherConstness>
       bool
-      operator>(const Iterator<Constness> &) const;
+      operator>(const Iterator<OtherConstness> &) const;
 
       /**
        * Exception
@@ -2706,8 +2710,9 @@ namespace TrilinosWrappers
 
 
     template <bool Constness>
+    template <bool OtherConstness>
     inline bool
-    Iterator<Constness>::operator==(const Iterator<Constness> &other) const
+    Iterator<Constness>::operator==(const Iterator<OtherConstness> &other) const
     {
       return (accessor.a_row == other.accessor.a_row &&
               accessor.a_index == other.accessor.a_index);
@@ -2716,8 +2721,9 @@ namespace TrilinosWrappers
 
 
     template <bool Constness>
+    template <bool OtherConstness>
     inline bool
-    Iterator<Constness>::operator!=(const Iterator<Constness> &other) const
+    Iterator<Constness>::operator!=(const Iterator<OtherConstness> &other) const
     {
       return !(*this == other);
     }
@@ -2725,8 +2731,9 @@ namespace TrilinosWrappers
 
 
     template <bool Constness>
+    template <bool OtherConstness>
     inline bool
-    Iterator<Constness>::operator<(const Iterator<Constness> &other) const
+    Iterator<Constness>::operator<(const Iterator<OtherConstness> &other) const
     {
       return (accessor.row() < other.accessor.row() ||
               (accessor.row() == other.accessor.row() &&
@@ -2735,8 +2742,9 @@ namespace TrilinosWrappers
 
 
     template <bool Constness>
+    template <bool OtherConstness>
     inline bool
-    Iterator<Constness>::operator>(const Iterator<Constness> &other) const
+    Iterator<Constness>::operator>(const Iterator<OtherConstness> &other) const
     {
       return (other < *this);
     }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.