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

前端 未结 11 853
我寻月下人不归
我寻月下人不归 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:15

    Since Qt 5.7 the foreach macro is deprecated, Qt encourages you to use the C++11 for instead.
    http://doc.qt.io/qt-5/qtglobal.html#foreach

    (more details about the difference here : https://www.kdab.com/goodbye-q_foreach/)

提交回复
热议问题