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/modules/objects/eventsystem
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/objects/eventsystem/EventDispatcher.cc

    r10768 r10821  
    4545    {
    4646        if (this->isInitialized())
    47             for (std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
    48                 (*it)->destroy();
     47            for (auto & elem : this->targets_)
     48                (elem)->destroy();
    4949    }
    5050
     
    6161    void EventDispatcher::processEvent(Event& event)
    6262    {
    63         for (std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
    64             (*it)->processEvent(event);
     63        for (auto & elem : this->targets_)
     64            (elem)->processEvent(event);
    6565    }
    6666
     
    7373    {
    7474        unsigned int i = 0;
    75         for (std::list<BaseObject*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
     75        for (const auto & elem : this->targets_)
    7676        {
    7777            if (i == index)
    78                 return (*it);
     78                return (elem);
    7979            ++i;
    8080        }
  • code/branches/cpp11_v2/src/modules/objects/eventsystem/EventFilter.cc

    r10768 r10821  
    9696    {
    9797        unsigned int i = 0;
    98         for (std::list<BaseObject*>::const_iterator it = this->sources_.begin(); it != this->sources_.end(); ++it)
     98        for (const auto & elem : this->sources_)
    9999        {
    100100            if (i == index)
    101                 return (*it);
     101                return (elem);
    102102            ++i;
    103103        }
     
    113113    {
    114114        unsigned int i = 0;
    115         for (std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)
     115        for (const auto & elem : this->names_)
    116116        {
    117117            if (i == index)
    118                 return (*it);
     118                return (elem);
    119119            ++i;
    120120        }
Note: See TracChangeset for help on using the changeset viewer.