From 65b81da458614c6a4652ea2e4fc933893c671281 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 4 Jan 2015 16:33:15 +0100 Subject: cmVariableWatch: Use the cmDeleteAll algorithm with for_each. --- Source/cmVariableWatch.cxx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index cb6cb12..b8a6df2 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -34,21 +34,16 @@ cmVariableWatch::cmVariableWatch() { } -cmVariableWatch::~cmVariableWatch() +template +void deleteAllSecond(typename C::value_type it) { - cmVariableWatch::StringToVectorOfPairs::iterator svp_it; - - for ( svp_it = this->WatchMap.begin(); - svp_it != this->WatchMap.end(); ++svp_it ) - { - cmVariableWatch::VectorOfPairs::iterator p_it; + cmDeleteAll(it.second); +} - for ( p_it = svp_it->second.begin(); - p_it != svp_it->second.end(); ++p_it ) - { - delete *p_it; - } - } +cmVariableWatch::~cmVariableWatch() +{ + std::for_each(this->WatchMap.begin(), this->WatchMap.end(), + deleteAllSecond); } bool cmVariableWatch::AddWatch(const std::string& variable, -- cgit v0.12