]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a default constructor for class ArrayView.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 8 Dec 2016 17:30:04 +0000 (10:30 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 8 Dec 2016 17:30:04 +0000 (10:30 -0700)
Right now, one can only create such an object pointing to a specific
array. It is not possible to default construct it, and consequently
you can't put them into collections, for example.

include/deal.II/base/array_view.h

index 77c96b02b06928fc1b21dc10cfe82d54cebd8c79..6850c1b2a3674333668c212f883422fabe8b3b63 100644 (file)
@@ -77,6 +77,12 @@ public:
    */
   typedef ElementType value_type;
 
+  /**
+   * Default constructor. Creates an invalid view that does not point to
+   * anything at all.
+   */
+  ArrayView ();
+
   /**
    * Constructor.
    *
@@ -147,6 +153,16 @@ private:
 //---------------------------------------------------------------------------
 
 
+template <typename ElementType>
+inline
+ArrayView<ElementType>::ArrayView()
+  :
+  starting_element (NULL),
+  n_elements(0)
+{}
+
+
+
 template <typename ElementType>
 inline
 ArrayView<ElementType>::ArrayView(value_type        *starting_element,

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.