Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFileSection.cc

    r10765 r10821  
    8080    {
    8181        unsigned int size = 0;
    82         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
    83             if ((*it)->getName() == name)
    84                 if ((*it)->getIndex() >= size)
    85                     size = (*it)->getIndex() + 1;
     82        for (const auto & elem : this->entries_)
     83            if ((elem)->getName() == name)
     84                if ((elem)->getIndex() >= size)
     85                    size = (elem)->getIndex() + 1;
    8686        return size;
    8787    }
     
    105105    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name) const
    106106    {
    107         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
     107        for (const auto & elem : this->entries_)
    108108        {
    109             if ((*it)->getName() == name)
    110                 return *it;
     109            if ((elem)->getName() == name)
     110                return elem;
    111111        }
    112112        return nullptr;
     
    121121    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name, unsigned int index) const
    122122    {
    123         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
     123        for (const auto & elem : this->entries_)
    124124        {
    125             if (((*it)->getName() == name) && ((*it)->getIndex() == index))
    126                 return *it;
     125            if (((elem)->getName() == name) && ((elem)->getIndex() == index))
     126                return elem;
    127127        }
    128128        return nullptr;
Note: See TracChangeset for help on using the changeset viewer.