]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow copying of ArrayViews of length zero.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 8 Dec 2016 04:29:17 +0000 (21:29 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 8 Dec 2016 04:29:17 +0000 (21:29 -0700)
include/deal.II/base/array_view.h

index c9d63d81cf82e80d8f0d0565e0961253072d880b..77c96b02b06928fc1b21dc10cfe82d54cebd8c79 100644 (file)
@@ -138,6 +138,8 @@ private:
    * The length of the array this object represents.
    */
   const std::size_t  n_elements;
+
+  friend class ArrayView<const ElementType>;
 };
 
 
@@ -160,8 +162,8 @@ template <typename ElementType>
 inline
 ArrayView<ElementType>::ArrayView(const ArrayView<typename boost::remove_cv<value_type>::type> &view)
   :
-  starting_element (&view[0]),
-  n_elements(view.size())
+  starting_element (view.starting_element),
+  n_elements(view.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.