X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fmodulecache.cpp;h=a0686902a8b1183d80f85835515bf7c496dd4bb8;hp=116eb20a288e977b1a5353576a5ed71f4fd6a023;hb=HEAD;hpb=f901fcf41d8ca544085f448227f84bc6f966660d diff --git a/source/glsl/modulecache.cpp b/source/glsl/modulecache.cpp index 116eb20a..a0686902 100644 --- a/source/glsl/modulecache.cpp +++ b/source/glsl/modulecache.cpp @@ -16,24 +16,24 @@ ModuleCache::ModuleCache(DataFile::Collection *r): ModuleCache::ModuleCache(const ModuleCache &other) { - for(map::const_iterator i=other.modules.begin(); i!=other.modules.end(); ++i) - modules[i->first] = new Module(*i->second); + for(const auto &kvp: other.modules) + modules[kvp.first] = new Module(*kvp.second); } ModuleCache &ModuleCache::operator=(const ModuleCache &other) { - for(map::iterator i=modules.begin(); i!=modules.end(); ++i) - delete i->second; + for(auto &kvp: modules) + delete kvp.second; modules.clear(); - for(map::const_iterator i=other.modules.begin(); i!=other.modules.end(); ++i) - modules[i->first] = new Module(*i->second); + for(const auto &kvp: other.modules) + modules[kvp.first] = new Module(*kvp.second); return *this; } ModuleCache::~ModuleCache() { - for(map::iterator i=modules.begin(); i!=modules.end(); ++i) - delete i->second; + for(auto &kvp: modules) + delete kvp.second; } const Module &ModuleCache::add_module(const string &source, const string &src_name) @@ -57,7 +57,7 @@ const Module &ModuleCache::add_module(IO::Base &io, const string &src_name) const Module &ModuleCache::get_module(const string &name) { string fn = name+".glsl"; - map::const_iterator i = modules.find(fn); + auto i = modules.find(fn); if(i!=modules.end()) return *i->second;