]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add some explicit casts to IndexSet. 13068/head
authorDavid Wells <drwells@email.unc.edu>
Mon, 13 Dec 2021 17:31:57 +0000 (12:31 -0500)
committerDavid Wells <drwells@email.unc.edu>
Mon, 13 Dec 2021 23:11:10 +0000 (18:11 -0500)
I tried adding an array PetscInts to an index set and got a sign conversion
warning.

include/deal.II/base/index_set.h

index 5d05fe75cde10f3a405157cbc5e286ebdd333c4b..4cb5d9856060b53cb3ca3ef16573fd43c95f7695 100644 (file)
@@ -1723,7 +1723,7 @@ IndexSet::add_indices(const ForwardIterator &begin, const ForwardIterator &end)
       size_type       end_index   = begin_index + 1;
       ForwardIterator q           = p;
       ++q;
-      while ((q != end) && (*q == end_index))
+      while ((q != end) && (static_cast<size_type>(*q) == end_index))
         {
           ++end_index;
           ++q;
@@ -1736,7 +1736,7 @@ IndexSet::add_indices(const ForwardIterator &begin, const ForwardIterator &end)
       // than the end index of the one just identified, then we will have at
       // least one pair of ranges that are not sorted, and consequently the
       // whole collection of ranges is not sorted.
-      if (p != end && *p < end_index)
+      if (p != end && static_cast<size_type>(*p) < end_index)
         ranges_are_sorted = false;
     }
 

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.