]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use a clearer way to empty arrays. 4773/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 10 Aug 2017 21:35:51 +0000 (15:35 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 10 Aug 2017 22:33:01 +0000 (16:33 -0600)
source/hp/dof_handler.cc

index 1f296ec5ea315b349dffe56056a766f15325dc9d..1393169c560977f3caa9eb3648ad3c98cfada6f2 100644 (file)
@@ -88,8 +88,7 @@ namespace internal
             std::vector<std::vector<DoFLevel::active_fe_index_type> >
             active_fe_backup(dof_handler.levels.size ());
             for (unsigned int level = 0; level<dof_handler.levels.size (); ++level)
-              std::swap (dof_handler.levels[level]->active_fe_indices,
-                         active_fe_backup[level]);
+              active_fe_backup[level] = std::move(dof_handler.levels[level]->active_fe_indices);
 
             // delete all levels and set them up newly, since vectors
             // are troublesome if you want to change their size
@@ -98,8 +97,7 @@ namespace internal
             for (unsigned int level=0; level<dof_handler.tria->n_levels(); ++level)
               {
                 dof_handler.levels.emplace_back (new internal::hp::DoFLevel);
-                std::swap (active_fe_backup[level],
-                           dof_handler.levels[level]->active_fe_indices);
+                dof_handler.levels[level]->active_fe_indices = std::move(active_fe_backup[level]);
               }
 
             if (dim > 1)
@@ -1648,15 +1646,8 @@ namespace hp
     levels.clear ();
     faces.reset ();
 
-    {
-      std::vector<types::global_dof_index> tmp;
-      std::swap (vertex_dofs, tmp);
-    }
-
-    {
-      std::vector<types::global_dof_index> tmp;
-      std::swap (vertex_dofs_offsets, tmp);
-    }
+    vertex_dofs = std::move(std::vector<types::global_dof_index>());
+    vertex_dofs_offsets = std::move (std::vector<types::global_dof_index>());
   }
 }
 

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.