]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix findings of "modernize-use-emplace" 5944/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 22 Feb 2018 03:25:22 +0000 (04:25 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 22 Feb 2018 20:42:03 +0000 (21:42 +0100)
17 files changed:
cmake/scripts/expand_instantiations.cc
examples/step-19/step-19.cc
examples/step-20/step-20.cc
examples/step-21/step-21.cc
examples/step-22/step-22.cc
examples/step-29/step-29.cc
examples/step-34/step-34.cc
examples/step-35/step-35.cc
examples/step-44/step-44.cc
examples/step-46/step-46.cc
examples/step-47/step-47.cc
examples/step-51/step-51.cc
examples/step-56/step-56.cc
examples/step-57/step-57.cc
examples/step-7/step-7.cc
examples/step-8/step-8.cc
tests/quick_tests/nanoflann.cc

index 2dc0f5f8ed6c09151027300e8bd076ec54ebe7f3..43906404e03c32161ca8b20e52d891b2161c5087 100644 (file)
@@ -493,8 +493,7 @@ void process_instantiations ()
 
           for (std::list<std::string>::const_iterator
                x = names.begin(); x != names.end(); ++x)
-            substitutions.push_back (std::make_pair (*x,
-                                                     names_and_type.back()));
+            substitutions.emplace_back (*x, names_and_type.back());
         }
 
       // now read the part in {...}
index da7008917ab117232635f8b81ae791f12e9b427d..491007c2fd3a1e1e0b614fa7cf3c1cf32f731baf 100644 (file)
@@ -245,7 +245,7 @@ namespace Step19
     // the name of the executable at the zeroth index:
     std::list<std::string> args;
     for (int i=1; i<argc; ++i)
-      args.push_back (argv[i]);
+      args.emplace_back(argv[i]);
 
     // Then process all these parameters. If the parameter is <code>-p</code>,
     // then there must be a parameter file following (which we should then
index 64361a5f3faad9fce1fb9d8af75f4f9c8d4fe747..142b7671918be87e11aa00db89d2edb1d5a10fd5 100644 (file)
@@ -867,7 +867,7 @@ namespace Step20
   void MixedLaplaceProblem<dim>::output_results () const
   {
     std::vector<std::string> solution_names(dim, "u");
-    solution_names.push_back ("p");
+    solution_names.emplace_back("p");
     std::vector<DataComponentInterpretation::DataComponentInterpretation>
     interpretation (dim,
                     DataComponentInterpretation::component_is_part_of_vector);
index 145a3ae3efadf59202cb152d5b30595ceea356d0..4b9e03b671dac3f811c8a62dcae4483a565d2fbf 100644 (file)
@@ -1103,18 +1103,18 @@ namespace Step21
     switch (dim)
       {
       case 2:
-        solution_names.push_back ("u");
-        solution_names.push_back ("v");
-        solution_names.push_back ("p");
-        solution_names.push_back ("S");
+        solution_names.emplace_back("u");
+        solution_names.emplace_back("v");
+        solution_names.emplace_back("p");
+        solution_names.emplace_back("S");
         break;
 
       case 3:
-        solution_names.push_back ("u");
-        solution_names.push_back ("v");
-        solution_names.push_back ("w");
-        solution_names.push_back ("p");
-        solution_names.push_back ("S");
+        solution_names.emplace_back("u");
+        solution_names.emplace_back("v");
+        solution_names.emplace_back("w");
+        solution_names.emplace_back("p");
+        solution_names.emplace_back("S");
         break;
 
       default:
index 6dec38d9aa291739fc0fcc5d48f9039e28c284b9..728724642e15264cea99575ab91c5b43675f736d 100644 (file)
@@ -855,7 +855,7 @@ namespace Step22
   StokesProblem<dim>::output_results (const unsigned int refinement_cycle)  const
   {
     std::vector<std::string> solution_names (dim, "velocity");
-    solution_names.push_back ("pressure");
+    solution_names.emplace_back("pressure");
 
     std::vector<DataComponentInterpretation::DataComponentInterpretation>
     data_component_interpretation
index 1505344aa614f8339459ada1c896763d7419a40e..3ba142e48a1b30254c1c248a891f778d91473848 100644 (file)
@@ -872,8 +872,8 @@ namespace Step29
     // The solution vectors $v$ and $w$ are added to the DataOut object in the
     // usual way:
     std::vector<std::string> solution_names;
-    solution_names.push_back ("Re_u");
-    solution_names.push_back ("Im_u");
+    solution_names.emplace_back("Re_u");
+    solution_names.emplace_back("Im_u");
 
     data_out.add_data_vector (solution, solution_names);
 
index 566102d4859490e9ce1c090d167657853cb67b35..f9b1a582cb1b52b2c16854fbdeaf881db5469f18 100644 (file)
@@ -880,9 +880,9 @@ namespace Step34
     static std::vector<QGaussOneOverR<2> > quadratures;
     if (quadratures.size() == 0)
       for (unsigned int i=0; i<fe.dofs_per_cell; ++i)
-        quadratures.push_back(QGaussOneOverR<2>(singular_quadrature_order,
-                                                fe.get_unit_support_points()[i],
-                                                true));
+        quadratures.emplace_back(singular_quadrature_order,
+                                 fe.get_unit_support_points()[i],
+                                 true);
     return quadratures[index];
   }
 
index 7599883b32e375a0e18f201f23528c23af88caba..4fa0a55391289e0c38c6d7bcfccb1e27fb09da34 100644 (file)
@@ -1337,8 +1337,8 @@ namespace Step35
             }
       }
     std::vector<std::string> joint_solution_names (dim, "v");
-    joint_solution_names.push_back ("p");
-    joint_solution_names.push_back ("rot_u");
+    joint_solution_names.emplace_back("p");
+    joint_solution_names.emplace_back("rot_u");
     DataOut<dim> data_out;
     data_out.attach_dof_handler (joint_dof_handler);
     std::vector< DataComponentInterpretation::DataComponentInterpretation >
index 6c9537354d5296a73f01fdaf7560ba1ba1d8e238..3ade96dcfbdc9235ad61469be74acf4eb544bc63 100644 (file)
@@ -3361,8 +3361,8 @@ namespace Step44
     data_component_interpretation.push_back(DataComponentInterpretation::component_is_scalar);
 
     std::vector<std::string> solution_name(dim, "displacement");
-    solution_name.push_back("pressure");
-    solution_name.push_back("dilatation");
+    solution_name.emplace_back("pressure");
+    solution_name.emplace_back("dilatation");
 
     data_out.attach_dof_handler(dof_handler_ref);
     data_out.add_data_vector(solution_n,
index b6cb342b43f3160c12622e298b2dc9d8de049d0b..e38569aea2453fc073d166d86723ac87864643a4 100644 (file)
@@ -888,9 +888,9 @@ namespace Step46
   output_results (const unsigned int refinement_cycle)  const
   {
     std::vector<std::string> solution_names (dim, "velocity");
-    solution_names.push_back ("pressure");
+    solution_names.emplace_back("pressure");
     for (unsigned int d=0; d<dim; ++d)
-      solution_names.push_back ("displacement");
+      solution_names.emplace_back("displacement");
 
     std::vector<DataComponentInterpretation::DataComponentInterpretation>
     data_component_interpretation
index d86bf9085c0155a63c5b6caa456896a450417374..1bf8da6d31048ffb4341966608d44622ceafc51e 100644 (file)
@@ -924,7 +924,7 @@ namespace Step47
   Postprocessor<dim>::get_names() const
   {
     std::vector<std::string> solution_names (1, "total_solution");
-    solution_names.push_back ("error");
+    solution_names.emplace_back("error");
     return solution_names;
   }
 
index b7fddfefe051ccaf8807d6834aa5a63846c45d91..d9ba4cd73941282d87eafcc54b01ac5b601a39b8 100644 (file)
@@ -1212,7 +1212,7 @@ namespace Step51
     // We first define the names and types of the local solution,
     // and add the data to @p data_out.
     std::vector<std::string> names (dim, "gradient");
-    names.push_back ("solution");
+    names.emplace_back("solution");
     std::vector<DataComponentInterpretation::DataComponentInterpretation>
     component_interpretation
     (dim+1, DataComponentInterpretation::component_is_part_of_vector);
index cf243aa7383eb45820916b9f74fd644c46feb154..b5815f6b4c53b0cf63235f9106a7f7e4d2f17a94 100644 (file)
@@ -1032,7 +1032,7 @@ namespace Step56
   StokesProblem<dim>::output_results (const unsigned int refinement_cycle)  const
   {
     std::vector<std::string> solution_names (dim, "velocity");
-    solution_names.push_back ("pressure");
+    solution_names.emplace_back("pressure");
 
     std::vector<DataComponentInterpretation::DataComponentInterpretation>
     data_component_interpretation
index ca3b6302dbb261245ec384f7f15bf9ede7074025..bdf3f54f66a26cf85fecbddd25524aea2910c173 100644 (file)
@@ -760,7 +760,7 @@ namespace Step57
   void StationaryNavierStokes<dim>::output_results (const unsigned int output_index)  const
   {
     std::vector<std::string> solution_names (dim, "velocity");
-    solution_names.push_back ("pressure");
+    solution_names.emplace_back("pressure");
 
     std::vector<DataComponentInterpretation::DataComponentInterpretation>
     data_component_interpretation
index 0e722b49c8cafb85190eb927919d267ce81201c4..9e7260de0412e8a1279174001e1e9a3acaf3b7aa 100644 (file)
@@ -1228,9 +1228,9 @@ namespace Step7
         // Selecting and re-ordering the columns works as follows (note that
         // this includes super columns):
         std::vector<std::string> new_order;
-        new_order.push_back("n cells");
-        new_order.push_back("H1");
-        new_order.push_back("L2");
+        new_order.emplace_back("n cells");
+        new_order.emplace_back("H1");
+        new_order.emplace_back("L2");
         convergence_table.set_column_order (new_order);
 
         // For everything that happened to the ConvergenceTable until this
index 1df8b0d2a2147c9b4d64a6f14a6bacb6cf3bf457..1ed56e2a46133bfbc45e1d6d1cd6d1d25b5333c9 100644 (file)
@@ -553,16 +553,16 @@ namespace Step8
     switch (dim)
       {
       case 1:
-        solution_names.push_back ("displacement");
+        solution_names.emplace_back("displacement");
         break;
       case 2:
-        solution_names.push_back ("x_displacement");
-        solution_names.push_back ("y_displacement");
+        solution_names.emplace_back("x_displacement");
+        solution_names.emplace_back("y_displacement");
         break;
       case 3:
-        solution_names.push_back ("x_displacement");
-        solution_names.push_back ("y_displacement");
-        solution_names.push_back ("z_displacement");
+        solution_names.emplace_back("x_displacement");
+        solution_names.emplace_back("y_displacement");
+        solution_names.emplace_back("z_displacement");
         break;
       default:
         Assert (false, ExcNotImplemented());
index 69bd2dc0a552c38828aa7b2d0aed7fc2db1e6e5b..ba851d66398bece99b7248e3aba7f9242ca6f090 100644 (file)
@@ -29,17 +29,17 @@ int main ()
   std::vector<Point<2> > points;
 
   // Add four points
-  points.push_back(Point<2>(0,0));
-  points.push_back(Point<2>(0,1));
-  points.push_back(Point<2>(1,0));
-  points.push_back(Point<2>(1,1));
+  points.emplace_back(0,0);
+  points.emplace_back(0,1);
+  points.emplace_back(1,0);
+  points.emplace_back(1,1);
 
   deallog << "Distance from unit square:" << std::endl;
 
   std::vector<Point<2> > test_points;
-  test_points.push_back(Point<2>(.5, .5));
-  test_points.push_back(Point<2>(2, 0));
-  test_points.push_back(Point<2>(2, 2));
+  test_points.emplace_back(.5, .5);
+  test_points.emplace_back(2, 0);
+  test_points.emplace_back(2, 2);
 
   kdtree.set_points(points);
 

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.