aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/songloading
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-01-29 23:49:59 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:46 +0100
commite3f328e4a24e2161fba58585e9f607c429b24c1b (patch)
tree2582ca2bdf221e3439bcabe688972f5cb1d5b4fe /src/base/songloading
parent2f2d371dbda69a3a364cd875c8181b072bcd7aeb (diff)
downloadusdx-e3f328e4a24e2161fba58585e9f607c429b24c1b.tar.gz
usdx-e3f328e4a24e2161fba58585e9f607c429b24c1b.tar.xz
usdx-e3f328e4a24e2161fba58585e9f607c429b24c1b.zip
delete all members of containers with std::for_each
Diffstat (limited to 'src/base/songloading')
-rw-r--r--src/base/songloading/songloader.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/base/songloading/songloader.cpp b/src/base/songloading/songloader.cpp
index b86f3100..9c1401ec 100644
--- a/src/base/songloading/songloader.cpp
+++ b/src/base/songloading/songloader.cpp
@@ -42,14 +42,17 @@ namespace usdx
strategies[".xml"] = new SongloadingStrategyXml();
}
- Songloader::~Songloader(void)
+ void remove_element(std::pair<std::string, SongloadingStrategy*> e)
{
- std::map<std::string, SongloadingStrategy*>::iterator it;
- for (it = strategies.begin(); it != strategies.end(); it++) {
- delete it->second;
- it->second = NULL;
- }
+ delete e.second;
+ e.second = NULL;
+ }
+ Songloader::~Songloader(void)
+ {
+ // clear memory for all elements in the map
+ std::for_each(strategies.begin(), strategies.end(),
+ remove_element);
strategies.clear();
// remove reference from singleton to make regeneration possible