You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use C++11 range for. Making the container const or using qAsConst() to cast
to const, so that container detachments are avoided.
Enforce it by adding QT_NO_FOREACH to the compilation definitions.
Rationale:
* Since Qt 5.7, the use of this macro is discouraged. It will be removed
in a future version of Qt.
* It only works efficiently on (some) Qt containers; it performs
prohibitively expensive on all std containers, QVarLengthArray, and
doesn’t work at all for C arrays.
* Even where it works as advertised, it typically costs ~100 bytes of text
size more per loop than the C++11 ranged for-loop.
* Its unconditionally taking a copy of the container makes it hard to
reason about the loop.
[1]: https://www.kdab.com/goodbye-q_foreach/
0 commit comments