mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 18:09:42 -05:00
Merge topic 'delete-algorithm'
65b81da4cmVariableWatch: Use the cmDeleteAll algorithm with for_each.30d2de9acmGeneratorExpressionEvaluator: Replace own algorithm with cmDeleteAll.4a6e795bUse the cmDeleteAll algorithm instead of trivial raw loops.abb4a678Add a generic algorithm for deleting items in a container.
This commit is contained in:
@@ -2051,31 +2051,10 @@ std::string GeneratorExpressionContent::EvaluateParameters(
|
||||
return std::string();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static void deleteAll(const std::vector<cmGeneratorExpressionEvaluator*> &c)
|
||||
{
|
||||
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
|
||||
= c.begin();
|
||||
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
|
||||
= c.end();
|
||||
for ( ; it != end; ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GeneratorExpressionContent::~GeneratorExpressionContent()
|
||||
{
|
||||
deleteAll(this->IdentifierChildren);
|
||||
|
||||
typedef std::vector<cmGeneratorExpressionEvaluator*> EvaluatorVector;
|
||||
std::vector<EvaluatorVector>::const_iterator pit =
|
||||
this->ParamChildren.begin();
|
||||
const std::vector<EvaluatorVector>::const_iterator pend =
|
||||
this->ParamChildren.end();
|
||||
for ( ; pit != pend; ++pit)
|
||||
{
|
||||
deleteAll(*pit);
|
||||
}
|
||||
cmDeleteAll(this->IdentifierChildren);
|
||||
std::for_each(this->ParamChildren.begin(), this->ParamChildren.end(),
|
||||
cmDeleteAll<std::vector<cmGeneratorExpressionEvaluator*> >);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user