return *this;
}
+ /**
+ * Create new iterator, which is shifted by @p offset.
+ */
+ VectorizedArrayIterator<T>
+ operator+(const unsigned int &offset) const
+ {
+ return VectorizedArrayIterator<T>(*data, lane + offset);
+ }
+
+ /**
+ * Compute distance between this iterator and iterator @p other.
+ */
+ unsigned int
+ operator-(const VectorizedArrayIterator<T> &other) const
+ {
+ AssertIndexRange(other.lane, lane + 1);
+ return lane - other.lane;
+ }
+
private:
/**
* Pointer to the actual VectorizedArray.
return x.get_min(y);
}
+
+
+ /**
+ * Iterator traits for VectorizedArrayIterator.
+ */
+ template <class T>
+ struct iterator_traits<dealii::VectorizedArrayIterator<T>>
+ {
+ using iterator_category = random_access_iterator_tag;
+ using value_type = typename T::value_type;
+ using difference_type = unsigned int;
+ };
+
} // namespace std
#endif
// ---------------------------------------------------------------------
-// test for std::max_element on VectorizedArray
+// test for std::max_element and std::distance on VectorizedArray
#include <deal.II/base/vectorization.h>
{
AssertDimension(*std::max_element(vector.begin(), vector.end()),
VectorizedArray<Number>::n_array_elements - 1);
+ AssertDimension(std::distance(vector.begin(),
+ std::max_element(vector.begin(), vector.end())),
+ VectorizedArray<Number>::n_array_elements - 1);
+ AssertDimension(std::distance(vector.begin(),
+ vector.begin() +
+ (VectorizedArray<Number>::n_array_elements -
+ 1)),
+ VectorizedArray<Number>::n_array_elements - 1);
}
template <typename Number>
{
AssertDimension(*std::max_element(vector.begin(), vector.end()),
VectorizedArray<Number>::n_array_elements - 1);
+ AssertDimension(std::distance(vector.begin(),
+ std::max_element(vector.begin(), vector.end())),
+ VectorizedArray<Number>::n_array_elements - 1);
+ AssertDimension(std::distance(vector.begin(),
+ vector.begin() +
+ (VectorizedArray<Number>::n_array_elements -
+ 1)),
+ VectorizedArray<Number>::n_array_elements - 1);
}
template <typename Number>