From: Wolfgang Bangerth Date: Fri, 26 Jan 2018 15:51:55 +0000 (-0700) Subject: Specialize ArrayViewHelper::is_contiguous() for pointers. X-Git-Tag: v9.0.0-rc1~507^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9ac4c7aaa6164fca5e17f1b1dafea5f80c4b81b;p=dealii.git Specialize ArrayViewHelper::is_contiguous() for pointers. --- diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 33e0e08484..04648f3d16 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -429,7 +429,12 @@ namespace internal { namespace ArrayViewHelper { - template + /** + * Return whether the objects one gets by dereferencing the + * iterators within the given iterator range form a contiguous + * range in memory. + */ + template bool is_contiguous(const Iterator &first, const Iterator &last) { const auto n = std::distance(first, last); @@ -438,6 +443,25 @@ namespace internal return false; return true; } + + + /** + * Return whether the objects one gets by dereferencing the + * iterators within the given iterator range form a contiguous + * range in memory. + * + * This specialization for (@p const or non-@p const) pointers + * returns @p true unconditionally since the fact that objects + * pointed to by pointers are contiguous is embedded in the memory + * model of C++. + */ + template + constexpr + bool is_contiguous(T *, + T *) + { + return true; + } } } #endif