From: David Wells Date: Sat, 8 Apr 2017 21:57:57 +0000 (-0400) Subject: Clean up some code with std_cxx14::make_unique. X-Git-Tag: v9.0.0-rc1~1707^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4238%2Fhead;p=dealii.git Clean up some code with std_cxx14::make_unique. --- diff --git a/source/numerics/data_out_dof_data.cc b/source/numerics/data_out_dof_data.cc index e767e33cc0..abac0f9b42 100644 --- a/source/numerics/data_out_dof_data.cc +++ b/source/numerics/data_out_dof_data.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -986,13 +987,13 @@ add_data_vector (const VectorType &vec, Assert (false, ExcInternalError()); } - internal::DataOut::DataEntryBase *new_entry - = new internal::DataOut::DataEntry(dofs, &vec, names, - data_component_interpretation); + auto new_entry = std_cxx14::make_unique> + (dofs, &vec, names, data_component_interpretation); + if (actual_type == type_dof_data) - dof_data.push_back (std::shared_ptr >(new_entry)); + dof_data.emplace_back (std::move(new_entry)); else - cell_data.push_back (std::shared_ptr >(new_entry)); + cell_data.emplace_back (std::move(new_entry)); } @@ -1018,9 +1019,9 @@ add_data_vector (const VectorType &vec, dofs->n_dofs(), dofs->get_triangulation().n_active_cells())); - internal::DataOut::DataEntryBase *new_entry - = new internal::DataOut::DataEntry(dofs, &vec, &data_postprocessor); - dof_data.push_back (std::shared_ptr >(new_entry)); + auto new_entry = std_cxx14::make_unique> + (dofs, &vec, &data_postprocessor); + dof_data.emplace_back (std::move(new_entry)); } @@ -1041,9 +1042,9 @@ add_data_vector (const DoFHandlerType &dof_handler, AssertDimension (vec.size(), dof_handler.n_dofs()); - internal::DataOut::DataEntryBase *new_entry - = new internal::DataOut::DataEntry(&dof_handler, &vec, &data_postprocessor); - dof_data.push_back (std::shared_ptr >(new_entry)); + auto new_entry = std_cxx14::make_unique> + (&dof_handler, &vec, &data_postprocessor); + dof_data.emplace_back (std::move(new_entry)); } @@ -1118,10 +1119,9 @@ add_data_vector std::vector (names.size(), DataComponentInterpretation::component_is_scalar)); - internal::DataOut::DataEntryBase *new_entry - = new internal::DataOut::DataEntry(&dof_handler, &data, names, - data_component_interpretation); - dof_data.push_back (std::shared_ptr >(new_entry)); + auto new_entry = std_cxx14::make_unique> + (&dof_handler, &data, names, data_component_interpretation); + dof_data.emplace_back (std::move(new_entry)); }