'for' loop vs Qt's 'foreach' in C++

前端 未结 11 866
我寻月下人不归
我寻月下人不归 2020-12-14 05:28

Which is better (or faster), a C++ for loop or the foreach operator provided by Qt? For example, the following condition

QList

        
11条回答
  •  甜味超标
    2020-12-14 06:07

    A benchmark, and its results, on this can be found at http://richelbilderbeek.nl/CppExerciseAddOneAnswer.htm

    IMHO (and many others here) it (that is speed) does not matter.

    But feel free to draw your own conclusions.

提交回复
热议问题