]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use the proper way to deal with std::unique_ptrs. 4683/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 3 Aug 2017 10:59:52 +0000 (04:59 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 3 Aug 2017 10:59:52 +0000 (04:59 -0600)
include/deal.II/hp/dof_handler.h

index f3155341727616a623c6342846de39d6df4c55db..c4be7e907a220793262d34c7456c1c41c618f150 100644 (file)
@@ -948,14 +948,9 @@ namespace hp
     // pointer object still points to something useful, that object is not
     // destroyed and we end up with a memory leak. consequently, first delete
     // previous content before re-loading stuff
-    for (unsigned int i = 0; i<levels.size(); ++i)
-      delete levels[i];
-    for (unsigned int i = 0; i<has_children.size(); ++i)
-      delete has_children[i];
-    levels.resize(0);
-    has_children.resize(0);
-    delete faces;
-    faces = 0;
+    levels.clear ();
+    has_children.clear ();
+    faces.reset ();
 
     ar &levels;
     ar &faces;

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.