diff --git a/src/libs/antares/study/include/antares/study/sets.h b/src/libs/antares/study/include/antares/study/sets.h index 0309916749..5bb4f12d99 100644 --- a/src/libs/antares/study/include/antares/study/sets.h +++ b/src/libs/antares/study/include/antares/study/sets.h @@ -134,7 +134,7 @@ class Sets final */ Sets(const Sets& rhs); //! Destructor - ~Sets(); + ~Sets() = default; //@} //! \name Iterators @@ -269,7 +269,7 @@ class Sets final MapType pMap; MapOptions pOptions; //! - TypePtr* pByIndex; + std::vector pByIndex; IDType* pNameByIndex; mutable bool pModified; diff --git a/src/libs/antares/study/include/antares/study/sets.hxx b/src/libs/antares/study/include/antares/study/sets.hxx index 931e044ba0..42b398c259 100644 --- a/src/libs/antares/study/include/antares/study/sets.hxx +++ b/src/libs/antares/study/include/antares/study/sets.hxx @@ -27,7 +27,6 @@ namespace Data { template inline Sets::Sets(): - pByIndex(NULL), pNameByIndex(NULL), pModified(false) { @@ -37,7 +36,6 @@ template inline Sets::Sets(const Sets& rhs): pMap(rhs.pMap), pOptions(rhs.pOptions), - pByIndex(NULL), pNameByIndex(NULL), pModified(false) { @@ -47,12 +45,6 @@ inline Sets::Sets(const Sets& rhs): } } -template -inline Sets::~Sets() -{ - delete[] pByIndex; -} - template typename Sets::iterator Sets::begin() { @@ -80,11 +72,7 @@ typename Sets::const_iterator Sets::end() const template void Sets::clear() { - if (pByIndex) - { - delete[] pByIndex; - pByIndex = NULL; - } + pByIndex.clear(); if (pNameByIndex) { delete[] pNameByIndex; @@ -401,12 +389,11 @@ void Sets::rebuildFromRules(const IDType& id, HandlerT& handler) template void Sets::rebuildIndexes() { - delete[] pByIndex; delete[] pNameByIndex; - + pByIndex.clear(); if (!pMap.empty()) { - pByIndex = new TypePtr[pMap.size()]; + pByIndex.resize(pMap.size()); pNameByIndex = new IDType[pMap.size()]; const typename MapType::iterator end = pMap.end(); uint index = 0; @@ -419,7 +406,6 @@ void Sets::rebuildIndexes() } else { - pByIndex = NULL; pNameByIndex = NULL; } }