]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make VectorSpaceVector's destructor virtual. 3657/head
authorDavid Wells <wellsd2@rpi.edu>
Sat, 3 Dec 2016 22:24:28 +0000 (17:24 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Sat, 3 Dec 2016 22:33:24 +0000 (17:33 -0500)
Since the classes inheriting from VectorSpaceVector all implement their own
memory management strategies, the destructor of the base class should always be
virtual.

include/deal.II/lac/la_parallel_block_vector.h
include/deal.II/lac/la_parallel_block_vector.templates.h
include/deal.II/lac/la_vector.h
include/deal.II/lac/vector_space_vector.h

index 2d325cf4ae95bcc2bd02c3ef63a63d391f890746..f96e64052e503700e326fe6517f8ea9c4adf74ef 100644 (file)
@@ -167,11 +167,6 @@ namespace LinearAlgebra
       BlockVector (const std::vector<IndexSet> &local_ranges,
                    const MPI_Comm  communicator);
 
-      /**
-       * Destructor. Clears memory.
-       */
-      ~BlockVector ();
-
       /**
        * Copy operator: fill all components of the vector with the given
        * scalar value.
index d2d02ad1d7586407ab5ffb3e161985ab2fa324a6..1f5ea732de6c7077dce7ba7ac8f7a38da1564e4f 100644 (file)
@@ -146,12 +146,6 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number>
-    BlockVector<Number>::~BlockVector ()
-    {}
-
-
-
     template <typename Number>
     BlockVector<Number> &
     BlockVector<Number>::operator = (const value_type s)
index 144315e5c0744af61edd396d6fb90334a80f95ec..ea1c083abb7301dddcf746e5bf69d16b7521e5b6 100644 (file)
@@ -86,11 +86,6 @@ namespace LinearAlgebra
     template <typename InputIterator>
     Vector(const InputIterator first, const InputIterator last);
 
-    /**
-     * Destructor, deallocates memory.
-     */
-    virtual ~Vector();
-
     /**
      * Copies the data of the input vector @p in_vector.
      */
@@ -327,12 +322,6 @@ namespace LinearAlgebra
 
 
 
-  template <typename Number>
-  inline
-  Vector<Number>::~Vector() {}
-
-
-
   template <typename Number>
   inline
   typename Vector<Number>::size_type Vector<Number>::size() const
index cb8c95fdc8afda8d4e78370160099b6191910d6d..b7158fa4128c64b79c02fa5b2a63db3516b73290 100644 (file)
@@ -207,8 +207,25 @@ namespace LinearAlgebra
      * Return the memory consumption of this class in bytes.
      */
     virtual std::size_t memory_consumption() const = 0;
+
+    /**
+     * Destructor. Declared as virtual so that inheriting classes (which may
+     * manage their own memory) are destroyed correctly.
+     */
+    virtual ~VectorSpaceVector();
   };
   /*@}*/
+
+
+
+#ifndef DOXYGEN
+  // TODO we can get rid of this when we require C++11 by using '=default'
+  // above
+  template <typename Number>
+  inline
+  VectorSpaceVector<Number>::~VectorSpaceVector()
+  {}
+#endif // DOXYGEN
 }
 
 DEAL_II_NAMESPACE_CLOSE

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.