Quote Originally Posted by wysota View Post
I'm pretty certain std::reverse uses the same algorithm your newReverse does
Actually I just added a stdReverseList to the mix
Qt Code:
  1. static inline QStringList stdReverseList(const QStringList &list)
  2. {
  3. QStringList reversedList = list;
  4. std::reverse(reversedList.begin(), reversedList.end());
  5. return reversedList;
  6. }
To copy to clipboard, switch view to plain text mode 

Result:
2000000 iterations of oldReverseList in 13 seconds
2000000 iterations of newReverseList in 7 seconds
2000000 iterations of stdReverseList in 14 seconds
My totaly unscientific guess to explain the result, would be that access via the iterators (as needed by std::reverse) is slower than access via operator[]...