]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use a swap in place of a copy. 4171/head
authorDavid Wells <wellsd2@rpi.edu>
Sat, 1 Apr 2017 16:53:08 +0000 (12:53 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sat, 1 Apr 2017 20:46:36 +0000 (16:46 -0400)
source/base/partitioner.cc

index 63f3edc9e30ab05486688646f319ea7dfb7a3618..3f4d01522bf1274bfd4da07af2b8c012b6a6ec8e 100644 (file)
@@ -269,6 +269,7 @@ namespace Utilities
 
         // allocate memory for import data
         std::vector<std::pair<unsigned int,unsigned int> > import_targets_temp;
+        import_targets_temp.reserve(n_procs);
         n_import_indices_data = 0;
         for (unsigned int i=0; i<n_procs; i++)
           if (receive_buffer[i] > 0)
@@ -277,7 +278,8 @@ namespace Utilities
               import_targets_temp.push_back(std::pair<unsigned int,
                                             unsigned int> (i, receive_buffer[i]));
             }
-        import_targets_data = import_targets_temp;
+
+        import_targets_data = std::move(import_targets_temp);
       }
 
       // send and receive indices for import data. non-blocking receives and

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.