]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use std::prev in one place. 12717/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 27 Aug 2021 20:26:21 +0000 (14:26 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 2 Sep 2021 20:37:10 +0000 (14:37 -0600)
include/deal.II/lac/block_indices.h

index 1c1315b4e2c1e161aa22e0eaa56ed0011d761695..3689b3c3e78210c6c4fd60aebb59a25a8a79f500 100644 (file)
@@ -25,6 +25,7 @@
 #include <deal.II/base/utilities.h>
 
 #include <cstddef>
+#include <iterator>
 #include <vector>
 
 DEAL_II_NAMESPACE_OPEN
@@ -331,9 +332,8 @@ BlockIndices::global_to_local(const size_type i) const
   Assert(n_blocks > 0, ExcLowerRangeType<size_type>(i, size_type(1)));
 
   // start_indices[0] == 0 so we might as well start from the next one
-  const auto it = --std::upper_bound(std::next(start_indices.begin()),
-                                     start_indices.end(),
-                                     i);
+  const auto it = std::prev(
+    std::upper_bound(std::next(start_indices.begin()), start_indices.end(), i));
 
   return {std::distance(start_indices.begin(), it), i - *it};
 }

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.