Use the QMap iterator instead of foreach(key, map.keys()).
Review Request #115018 - Created Jan. 15, 2014 and submitted
Use the QMap iterator instead of foreach(key, map.keys()) in UpdateItemStatesThread::run() and in VersionControlObserver::slotThreadFinished().
Is there a reason why you want to change this? I mean, it seems a matter of taste. I kinda like the foreach version ;) Not my place to say +1 or -1 so i leave that to others, just curious abdout the "why".
Thanks for the patch! I first thought that replacing the foreach loop would probably not affect the performance much, but when iterating the keys of a QMap, rather than, e.g., the elements of a QVector, it saves the creation of the temporary list returned by itemStates.keys() (I guess that this was also the explanation that Thiago gave - maybe it was in a private discussion, Mark? I could not see any comment from Thiago here). One could in principle move the declaration of 'it' into the for statement, but I assume that you did not do this in order to prevent that the line gets too long? Either solution is fine for me.