From: Wolfgang Bangerth Date: Tue, 10 Oct 2023 15:10:55 +0000 (-0600) Subject: Restrict checking ArrayView validity to debug mode. X-Git-Tag: relicensing~416^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=235e60d100143aaed73a000f4260a3c8294a811f;p=dealii.git Restrict checking ArrayView validity to debug mode. --- diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index a500702329..e53dd0f1b9 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -403,7 +403,12 @@ template inline ArrayView::ArrayView( value_type *starting_element, const std::size_t n_elements) - : starting_element(n_elements > 0 ? starting_element : nullptr) + : +#ifdef DEBUG + starting_element(n_elements > 0 ? starting_element : nullptr) +#else + starting_element(starting_element) +#endif , n_elements(n_elements) {} @@ -414,10 +419,14 @@ inline void ArrayView::reinit(value_type *starting_element, const std::size_t n_elements) { +#ifdef DEBUG if (n_elements > 0) this->starting_element = starting_element; else this->starting_element = nullptr; +#else + this->starting_element = starting_element; +#endif this->n_elements = n_elements; }