diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-04 15:33:15 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-01-13 22:00:17 (GMT) |
commit | 65b81da458614c6a4652ea2e4fc933893c671281 (patch) | |
tree | 64137e48ba67c70af36d3d1e8c807af3f3d8b3a3 /Source/cmVariableWatch.cxx | |
parent | 30d2de9aa82196a12f47930e736181c48c568585 (diff) | |
download | CMake-65b81da458614c6a4652ea2e4fc933893c671281.zip CMake-65b81da458614c6a4652ea2e4fc933893c671281.tar.gz CMake-65b81da458614c6a4652ea2e4fc933893c671281.tar.bz2 |
cmVariableWatch: Use the cmDeleteAll algorithm with for_each.
Diffstat (limited to 'Source/cmVariableWatch.cxx')
-rw-r--r-- | Source/cmVariableWatch.cxx | 21 |
1 files 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<typename C> +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<cmVariableWatch::StringToVectorOfPairs>); } bool cmVariableWatch::AddWatch(const std::string& variable, |