From: David Wells Date: Tue, 7 May 2019 00:29:37 +0000 (-0400) Subject: step-28: Convert raw pointers to unique_ptrs. X-Git-Tag: v9.1.0-rc1~118^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43755302ac5615c7d0b6d51764ffad8dd50a4fca;p=dealii.git step-28: Convert raw pointers to unique_ptrs. --- 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)); }