]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Declare local difference_type for sparse matrix iterators.
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 28 Aug 2021 22:23:37 +0000 (16:23 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 2 Sep 2021 20:36:56 +0000 (14:36 -0600)
include/deal.II/lac/block_vector_base.h
include/deal.II/lac/sparse_matrix.h

index 015da300fa0db155def7fc9a661ca7127d86961c..87b5335127e7a5481566159029be20e5ce0c99cd 100644 (file)
@@ -141,9 +141,10 @@ namespace internal
                                   typename BlockVectorType::value_type>::type;
 
       /**
-       * Declare some alias which are standard for iterators and are used
+       * Declare some aliases that are standard for iterators and are used
        * by algorithms to enquire about the specifics of the iterators they
-       * work on.
+       * work on. (Example: `std::next()`, which needs to know about a local
+       * type named `difference_type`.)
        */
       using iterator_category = std::random_access_iterator_tag;
       using difference_type   = std::ptrdiff_t;
index 8e9bab90781193c9502172a0f59fb1f4cec6b20a..ed2e4c4bcec5eb26bef79b2bd82c0e33e5a06b59 100644 (file)
@@ -360,6 +360,8 @@ namespace SparseMatrixIterators
      */
     using value_type = const Accessor<number, Constness> &;
 
+    using difference_type = size_type;
+
     /**
      * Constructor. Create an iterator into the matrix @p matrix for the given
      * index in the complete matrix (counting from the zeroth entry).

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.