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/weaponsystem/Weapon.cc

    r10768 r10821  
    6161                this->weaponPack_->removeWeapon(this);
    6262
    63             for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    64                 it->second->destroy();
     63            for (auto & elem : this->weaponmodes_)
     64                elem.second->destroy();
    6565        }
    6666    }
     
    8585    {
    8686        unsigned int i = 0;
    87         for (std::multimap<unsigned int, WeaponMode*>::const_iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
     87        for (const auto & elem : this->weaponmodes_)
    8888        {
    8989            if (i == index)
    90                 return it->second;
     90                return elem.second;
    9191
    9292            ++i;
     
    136136    void Weapon::reload()
    137137    {
    138         for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    139             it->second->reload();
     138        for (auto & elem : this->weaponmodes_)
     139            elem.second->reload();
    140140    }
    141141
     
    148148    void Weapon::notifyWeaponModes()
    149149    {
    150         for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    151             it->second->setWeapon(this);
     150        for (auto & elem : this->weaponmodes_)
     151            elem.second->setWeapon(this);
    152152    }
    153153}
Note: See TracChangeset for help on using the changeset viewer.