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/LuaState.cc

    r10817 r10821  
    326326    /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
    327327    {
    328         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    329         {
    330             if (it->first == name || it->second == function)
     328        for (const auto & interface : getToluaInterfaces())
     329        {
     330            if (interface.first == name || interface.second == function)
    331331            {
    332332                orxout(internal_warning, context::lua) << "Trying to add a Tolua interface with the same name or function." << endl;
     
    337337
    338338        // Open interface in all LuaStates
    339         for (std::vector<LuaState*>::const_iterator it = getInstances().begin(); it != getInstances().end(); ++it)
    340             (*function)((*it)->luaState_);
     339        for (const auto & state : getInstances())
     340            (*function)(state->luaState_);
    341341
    342342        // Return dummy bool
     
    354354
    355355        // Close interface in all LuaStates
    356         for (std::vector<LuaState*>::const_iterator itState = getInstances().begin(); itState != getInstances().end(); ++itState)
    357         {
    358             lua_pushnil((*itState)->luaState_);
    359             lua_setglobal((*itState)->luaState_, it->first.c_str());
     356        for (const auto & state : getInstances())
     357        {
     358            lua_pushnil(state->luaState_);
     359            lua_setglobal(state->luaState_, it->first.c_str());
    360360        }
    361361
     
    369369    /*static*/ void LuaState::openToluaInterfaces(lua_State* state)
    370370    {
    371         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    372             (*it->second)(state);
     371        for (const auto & interface : getToluaInterfaces())
     372            (interface.second)(state);
    373373    }
    374374
    375375    /*static*/ void LuaState::closeToluaInterfaces(lua_State* state)
    376376    {
    377         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
     377        for (const auto & interface : getToluaInterfaces())
    378378        {
    379379            lua_pushnil(state);
    380             lua_setglobal(state, it->first.c_str());
     380            lua_setglobal(state, interface.first.c_str());
    381381        }
    382382    }
Note: See TracChangeset for help on using the changeset viewer.