/**
* Iterator category.
*/
+#ifdef DEAL_II_HAVE_CXX20
+ using iterator_category = std::contiguous_iterator_tag;
+#else
using iterator_category = std::random_access_iterator_tag;
+#endif
/**
* An alias for the type you get when you dereference an iterator of the
template <class T>
struct iterator_traits<dealii::VectorizedArrayIterator<T>>
{
+#ifdef DEAL_II_HAVE_CXX20
+ using iterator_category = contiguous_iterator_tag;
+#else
using iterator_category = random_access_iterator_tag;
- using value_type = typename T::value_type;
- using difference_type = std::ptrdiff_t;
+#endif
+ using value_type = typename T::value_type;
+ using difference_type = std::ptrdiff_t;
};
} // namespace std
* by algorithms to enquire about the specifics of the iterators they
* work on. (Example: `std::next()`, which needs to know about a local
* type named `difference_type`.)
+ *
+ * As for the iterator_category, C++20 has a more specialized
+ * contiguous_iterator_tag, but the elements of block vectors are
+ * not stored in a contiguous manner. They can be accessed in a
+ * random access order, though, with O(1) effort as long as we
+ * assume that the number of blocks of a vector is a constant
+ * (even though the *size* of the vector is not).
*/
using iterator_category = std::random_access_iterator_tag;
using difference_type = std::ptrdiff_t;