Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (9 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
Location:
code/branches/cpp11_v2/src/libraries/core/module
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/module/DynLibManager.cc

    r10768 r10821  
    7575    {
    7676        // Unload & delete resources in turn
    77         for (DynLibList::iterator it = mLibList.begin(); it != mLibList.end(); ++it)
     77        for (auto & elem : mLibList)
    7878        {
    79             it->second->unload();
    80             delete it->second;
     79            elem.second->unload();
     80            delete elem.second;
    8181        }
    8282
  • code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc

    r10769 r10821  
    5959    {
    6060        const std::set<StaticallyInitializedInstance*>& instances = this->staticallyInitializedInstancesByType_[type];
    61         for (std::set<StaticallyInitializedInstance*>::iterator it = instances.begin(); it != instances.end(); ++it)
    62             (*it)->load();
     61        for (const auto & instance : instances)
     62            (instance)->load();
    6363    }
    6464
     
    7575        std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> copy(this->staticallyInitializedInstancesByType_);
    7676        this->staticallyInitializedInstancesByType_.clear();
    77         for (std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>>::iterator it1 = copy.begin(); it1 != copy.end(); ++it1)
    78             for (std::set<StaticallyInitializedInstance*>::iterator it2 = it1->second.begin(); it2 != it1->second.end(); ++it2)
     77        for (auto & elem : copy)
     78            for (std::set<StaticallyInitializedInstance*>::iterator it2 = elem.second.begin(); it2 != elem.second.end(); ++it2)
    7979                delete (*it2);
    8080    }
  • code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc

    r10768 r10821  
    5959        ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(nullptr);
    6060
    61         for (std::map<std::string, PluginReference*>::iterator it = this->references_.begin(); it != this->references_.end(); ++it)
    62             delete it->second;
    63         for (std::map<std::string, Plugin*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)
    64             delete it->second;
     61        for (auto & elem : this->references_)
     62            delete elem.second;
     63        for (auto & elem : this->plugins_)
     64            delete elem.second;
    6565    }
    6666
     
    6868    {
    6969        const std::vector<std::string>& pluginPaths = ApplicationPaths::getInstance().getPluginPaths();
    70         for (std::vector<std::string>::const_iterator it = pluginPaths.begin(); it != pluginPaths.end(); ++it)
     70        for (auto libraryName : pluginPaths)
    7171        {
    7272            std::string name;
    73             std::string libraryName = (*it);
     73           
    7474            std::string filename = libraryName +  + specialConfig::pluginExtension;
    7575            std::ifstream infile(filename.c_str());
  • code/branches/cpp11_v2/src/libraries/core/module/StaticInitializationManager.cc

    r10768 r10821  
    5050    {
    5151        // attention: loading a module may add new handlers to the list
    52         for (std::list<StaticInitializationHandler*>::iterator it = this->handlers_.begin(); it != this->handlers_.end(); ++it)
    53             (*it)->loadModule(module);
     52        for (auto & elem : this->handlers_)
     53            (elem)->loadModule(module);
    5454    }
    5555
Note: See TracChangeset for help on using the changeset viewer.