From eea2996c211cb4be794df0477554426a67136148 Mon Sep 17 00:00:00 2001 From: Walter Van Herck <w.van.herck@fz-juelich.de> Date: Mon, 23 Sep 2013 10:51:47 +0200 Subject: [PATCH] Refactor: replaced std::vector of pointers with SafePointerVector --- Core/Algorithms/inc/DiffuseDWBASimulation.h | 2 +- Core/Algorithms/src/DiffuseDWBASimulation.cpp | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Core/Algorithms/inc/DiffuseDWBASimulation.h b/Core/Algorithms/inc/DiffuseDWBASimulation.h index ee2a768e020..c22e6a074c9 100644 --- a/Core/Algorithms/inc/DiffuseDWBASimulation.h +++ b/Core/Algorithms/inc/DiffuseDWBASimulation.h @@ -62,7 +62,7 @@ protected: double m_factor; }; void initDiffuseFormFactorTerms( - std::vector<DiffuseFormFactorTerm *>& terms, + SafePointerVector<DiffuseFormFactorTerm>& terms, size_t nbr_heights, size_t samples_per_particle, complex_t wavevector_scattering_factor); }; diff --git a/Core/Algorithms/src/DiffuseDWBASimulation.cpp b/Core/Algorithms/src/DiffuseDWBASimulation.cpp index a9b2548d99d..76c3b17696b 100644 --- a/Core/Algorithms/src/DiffuseDWBASimulation.cpp +++ b/Core/Algorithms/src/DiffuseDWBASimulation.cpp @@ -23,7 +23,7 @@ void DiffuseDWBASimulation::run() { msglog(MSG::DEBUG) << "DiffuseDWBASimulation::run()"; // Set diffuse terms. - std::vector<DiffuseFormFactorTerm*> diffuse_terms; + SafePointerVector<DiffuseFormFactorTerm> diffuse_terms; size_t nbr_heights = 50; size_t samples_per_particle = 9; double wavevector_scattering_factor = M_PI/getWaveLength()/getWaveLength(); @@ -62,9 +62,6 @@ void DiffuseDWBASimulation::run() } *it_intensity = total_intensity; } - - for (size_t i=0; i<diffuse_terms.size(); ++i) - delete diffuse_terms[i]; } //! Initializes vector<DiffuseFormFactorTerm*> term. @@ -76,7 +73,7 @@ void DiffuseDWBASimulation::run() //! - m_form_factors <- vector<FormFactorDWBAConstZ*> //! void DiffuseDWBASimulation::initDiffuseFormFactorTerms( - std::vector<DiffuseFormFactorTerm*>& terms, + SafePointerVector<DiffuseFormFactorTerm>& terms, size_t nbr_heights, size_t samples_per_particle, complex_t wavevector_scattering_factor) { -- GitLab