]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Restrict checking ArrayView validity to debug mode. 16115/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 10 Oct 2023 15:10:55 +0000 (09:10 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 10 Oct 2023 15:10:55 +0000 (09:10 -0600)
include/deal.II/base/array_view.h

index a5007023295e1d820ae33b2013cb1bd4c71e9de0..e53dd0f1b98dbdb336bc38621f577832f13c93dd 100644 (file)
@@ -403,7 +403,12 @@ template <typename ElementType, typename MemorySpaceType>
 inline ArrayView<ElementType, MemorySpaceType>::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<ElementType, MemorySpaceType>::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;
 }
 

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.