diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx index 96fdb3e4f..517411887 100644 --- a/Source/cmExportSetMap.cxx +++ b/Source/cmExportSetMap.cxx @@ -23,7 +23,7 @@ cmExportSet* cmExportSetMap::operator[](const std::string &name) return it->second; } -cmExportSetMap::~cmExportSetMap() +void cmExportSetMap::clear() { for(std::map::iterator it = this->begin(); it != this->end(); @@ -31,4 +31,10 @@ cmExportSetMap::~cmExportSetMap() { delete it->second; } + this->derived::clear(); +} + +cmExportSetMap::~cmExportSetMap() +{ + this->clear(); } diff --git a/Source/cmExportSetMap.h b/Source/cmExportSetMap.h index 4663c5538..965046cef 100644 --- a/Source/cmExportSetMap.h +++ b/Source/cmExportSetMap.h @@ -18,6 +18,7 @@ class cmExportSet; /// A name -> cmExportSet map with overloaded operator[]. class cmExportSetMap : public std::map { + typedef std::map derived; public: /** \brief Overloaded operator[]. * @@ -26,6 +27,8 @@ public: */ cmExportSet* operator[](const std::string &name); + void clear(); + /// Overloaded destructor deletes all member export sets. ~cmExportSetMap(); };