Merge topic 'clear-generator-data'

00055ce cmExportSetMap: Override clear() to delete held resources
This commit is contained in:
Brad King 2013-11-12 08:31:39 -05:00 committed by CMake Topic Stage
commit cb4a4686ac
2 changed files with 10 additions and 1 deletions

View File

@ -23,7 +23,7 @@ cmExportSet* cmExportSetMap::operator[](const std::string &name)
return it->second; return it->second;
} }
cmExportSetMap::~cmExportSetMap() void cmExportSetMap::clear()
{ {
for(std::map<std::string, cmExportSet*>::iterator it = this->begin(); for(std::map<std::string, cmExportSet*>::iterator it = this->begin();
it != this->end(); it != this->end();
@ -31,4 +31,10 @@ cmExportSetMap::~cmExportSetMap()
{ {
delete it->second; delete it->second;
} }
this->derived::clear();
}
cmExportSetMap::~cmExportSetMap()
{
this->clear();
} }

View File

@ -18,6 +18,7 @@ class cmExportSet;
/// A name -> cmExportSet map with overloaded operator[]. /// A name -> cmExportSet map with overloaded operator[].
class cmExportSetMap : public std::map<std::string, cmExportSet*> class cmExportSetMap : public std::map<std::string, cmExportSet*>
{ {
typedef std::map<std::string, cmExportSet*> derived;
public: public:
/** \brief Overloaded operator[]. /** \brief Overloaded operator[].
* *
@ -26,6 +27,8 @@ public:
*/ */
cmExportSet* operator[](const std::string &name); cmExportSet* operator[](const std::string &name);
void clear();
/// Overloaded destructor deletes all member export sets. /// Overloaded destructor deletes all member export sets.
~cmExportSetMap(); ~cmExportSetMap();
}; };