Skip to content

Commit

Permalink
sets byIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Jul 18, 2024
1 parent 6c3646b commit 6015a25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/libs/antares/study/include/antares/study/sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Sets final
*/
Sets(const Sets& rhs);
//! Destructor
~Sets();
~Sets() = default;
//@}

//! \name Iterators
Expand Down Expand Up @@ -269,7 +269,7 @@ class Sets final
MapType pMap;
MapOptions pOptions;
//!
TypePtr* pByIndex;
std::vector<TypePtr> pByIndex;
IDType* pNameByIndex;
mutable bool pModified;

Expand Down
20 changes: 3 additions & 17 deletions src/libs/antares/study/include/antares/study/sets.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace Data
{
template<class T>
inline Sets<T>::Sets():
pByIndex(NULL),
pNameByIndex(NULL),
pModified(false)
{
Expand All @@ -37,7 +36,6 @@ template<class T>
inline Sets<T>::Sets(const Sets& rhs):
pMap(rhs.pMap),
pOptions(rhs.pOptions),
pByIndex(NULL),
pNameByIndex(NULL),
pModified(false)
{
Expand All @@ -47,12 +45,6 @@ inline Sets<T>::Sets(const Sets& rhs):
}
}

template<class T>
inline Sets<T>::~Sets()
{
delete[] pByIndex;
}

template<class T>
typename Sets<T>::iterator Sets<T>::begin()
{
Expand Down Expand Up @@ -80,11 +72,7 @@ typename Sets<T>::const_iterator Sets<T>::end() const
template<class T>
void Sets<T>::clear()
{
if (pByIndex)
{
delete[] pByIndex;
pByIndex = NULL;
}
pByIndex.clear();
if (pNameByIndex)
{
delete[] pNameByIndex;
Expand Down Expand Up @@ -401,12 +389,11 @@ void Sets<T>::rebuildFromRules(const IDType& id, HandlerT& handler)
template<class T>
void Sets<T>::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;
Expand All @@ -419,7 +406,6 @@ void Sets<T>::rebuildIndexes()
}
else
{
pByIndex = NULL;
pNameByIndex = NULL;
}
}
Expand Down

0 comments on commit 6015a25

Please sign in to comment.