Merge topic 'delete-algorithm'
681d965d Use the cmDeleteAll algorithm for types derived from std::map. 4dc0c488 cmDeleteAll: Generalize deletion specialization for map types.
This commit is contained in:
commit
95d42840e8
@ -25,12 +25,7 @@ cmExportSet* cmExportSetMap::operator[](const std::string &name)
|
|||||||
|
|
||||||
void cmExportSetMap::clear()
|
void cmExportSetMap::clear()
|
||||||
{
|
{
|
||||||
for(std::map<std::string, cmExportSet*>::iterator it = this->begin();
|
cmDeleteAll(*this);
|
||||||
it != this->end();
|
|
||||||
++ it)
|
|
||||||
{
|
|
||||||
delete it->second;
|
|
||||||
}
|
|
||||||
this->derived::clear();
|
this->derived::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1510,11 +1510,7 @@ void cmGlobalGenerator::CreateGeneratorTargets()
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalGenerator::ClearGeneratorMembers()
|
void cmGlobalGenerator::ClearGeneratorMembers()
|
||||||
{
|
{
|
||||||
for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin();
|
cmDeleteAll(this->GeneratorTargets);
|
||||||
i != this->GeneratorTargets.end(); ++i)
|
|
||||||
{
|
|
||||||
delete i->second;
|
|
||||||
}
|
|
||||||
this->GeneratorTargets.clear();
|
this->GeneratorTargets.clear();
|
||||||
|
|
||||||
cmDeleteAll(this->EvaluationFiles);
|
cmDeleteAll(this->EvaluationFiles);
|
||||||
|
@ -239,7 +239,20 @@ private:
|
|||||||
|
|
||||||
namespace ContainerAlgorithms {
|
namespace ContainerAlgorithms {
|
||||||
|
|
||||||
template<typename Container>
|
template<typename T>
|
||||||
|
struct cmIsPair
|
||||||
|
{
|
||||||
|
enum { value = false };
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename K, typename V>
|
||||||
|
struct cmIsPair<std::pair<K, V> >
|
||||||
|
{
|
||||||
|
enum { value = true };
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Container,
|
||||||
|
bool valueTypeIsPair = cmIsPair<typename Container::value_type>::value>
|
||||||
struct DefaultDeleter
|
struct DefaultDeleter
|
||||||
{
|
{
|
||||||
void operator()(typename Container::value_type value) {
|
void operator()(typename Container::value_type value) {
|
||||||
@ -247,10 +260,10 @@ struct DefaultDeleter
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename K, typename V>
|
template<typename Container>
|
||||||
struct DefaultDeleter<std::map<K, V> >
|
struct DefaultDeleter<Container, /* valueTypeIsPair = */ true>
|
||||||
{
|
{
|
||||||
void operator()(typename std::map<K, V>::value_type value) {
|
void operator()(typename Container::value_type value) {
|
||||||
delete value.second;
|
delete value.second;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -539,12 +539,7 @@ void cmTarget::ClearLinkMaps()
|
|||||||
this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear();
|
this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear();
|
||||||
this->Internal->LinkClosureMap.clear();
|
this->Internal->LinkClosureMap.clear();
|
||||||
this->Internal->SourceFilesMap.clear();
|
this->Internal->SourceFilesMap.clear();
|
||||||
for (cmTargetLinkInformationMap::const_iterator it
|
cmDeleteAll(this->LinkInformation);
|
||||||
= this->LinkInformation.begin();
|
|
||||||
it != this->LinkInformation.end(); ++it)
|
|
||||||
{
|
|
||||||
delete it->second;
|
|
||||||
}
|
|
||||||
this->LinkInformation.clear();
|
this->LinkInformation.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6874,10 +6869,7 @@ cmTargetLinkInformationMap
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmTargetLinkInformationMap::~cmTargetLinkInformationMap()
|
cmTargetLinkInformationMap::~cmTargetLinkInformationMap()
|
||||||
{
|
{
|
||||||
for(derived::iterator i = this->begin(); i != this->end(); ++i)
|
cmDeleteAll(*this);
|
||||||
{
|
|
||||||
delete i->second;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user