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/orxonox/worldentities/WorldEntity.cc

    r10774 r10821  
    233233
    234234            // iterate over all children and change their activity as well
    235             for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     235            for (const auto & elem : this->getAttachedObjects())
    236236            {
    237237                if(!this->isActive())
    238238                {
    239                     (*it)->bActiveMem_ = (*it)->isActive();
    240                     (*it)->setActive(this->isActive());
     239                    (elem)->bActiveMem_ = (elem)->isActive();
     240                    (elem)->setActive(this->isActive());
    241241                }
    242242                else
    243243                {
    244                     (*it)->setActive((*it)->bActiveMem_);
     244                    (elem)->setActive((elem)->bActiveMem_);
    245245                }
    246246            }
     
    259259        {
    260260            // iterate over all children and change their visibility as well
    261             for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     261            for (const auto & elem : this->getAttachedObjects())
    262262            {
    263263                if(!this->isVisible())
    264264                {
    265                     (*it)->bVisibleMem_ = (*it)->isVisible();
    266                     (*it)->setVisible(this->isVisible());
     265                    (elem)->bVisibleMem_ = (elem)->isVisible();
     266                    (elem)->setVisible(this->isVisible());
    267267                }
    268268                else
    269269                {
    270                     (*it)->setVisible((*it)->bVisibleMem_);
     270                    (elem)->setVisible((elem)->bVisibleMem_);
    271271                }
    272272            }
     
    518518    {
    519519        unsigned int i = 0;
    520         for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
     520        for (const auto & elem : this->children_)
    521521        {
    522522            if (i == index)
    523                 return (*it);
     523                return (elem);
    524524            ++i;
    525525        }
     
    938938        // Recalculate mass
    939939        this->childrenMass_ = 0.0f;
    940         for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    941             this->childrenMass_ += (*it)->getMass();
     940        for (const auto & elem : this->children_)
     941            this->childrenMass_ += (elem)->getMass();
    942942        recalculateMassProps();
    943943        // Notify parent WE
Note: See TracChangeset for help on using the changeset viewer.