From 43755302ac5615c7d0b6d51764ffad8dd50a4fca Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 6 May 2019 20:29:37 -0400 Subject: [PATCH] step-28: Convert raw pointers to unique_ptrs. --- examples/step-28/step-28.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/examples/step-28/step-28.cc b/examples/step-28/step-28.cc index b45df6eb6a..171a0b385a 100644 --- a/examples/step-28/step-28.cc +++ b/examples/step-28/step-28.cc @@ -1165,10 +1165,7 @@ namespace Step28 double convergence_tolerance; }; - - NeutronDiffusionProblem(const Parameters ¶meters); - ~NeutronDiffusionProblem(); void run(); @@ -1209,7 +1206,7 @@ namespace Step28 // Finally, (v), we have an array of pointers to the energy group // objects. The length of this array is, of course, equal to the number of // energy groups specified in the parameter file. - std::vector *> energy_groups; + std::vector>> energy_groups; }; @@ -1283,15 +1280,6 @@ namespace Step28 - template - NeutronDiffusionProblem::~NeutronDiffusionProblem() - { - for (unsigned int group = 0; group < energy_groups.size(); ++group) - delete energy_groups[group]; - - energy_groups.resize(0); - } - // @sect5{NeutronDiffusionProblem::initialize_problem} // // The first function of interest is the one that sets up the geometry of @@ -1466,10 +1454,9 @@ namespace Step28 // With the coarse mesh so initialized, we create the appropriate number // of energy group objects and let them initialize their individual meshes // with the coarse mesh generated above: - energy_groups.resize(parameters.n_groups); for (unsigned int group = 0; group < parameters.n_groups; ++group) - energy_groups[group] = - new EnergyGroup(group, material_data, coarse_grid, fe); + energy_groups.emplace_back(std_cxx14::make_unique>( + group, material_data, coarse_grid, fe)); } -- 2.39.5