From de2f6d62725ba45a9b2743c948a5f4aee65bd3f4 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 8 Apr 2017 17:57:57 -0400 Subject: [PATCH] Clean up some code with std_cxx14::make_unique. --- source/numerics/data_out_dof_data.cc | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) 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)); } -- 2.39.5