-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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/
- Loading branch information
1 parent
09d58f1
commit 1cfca7c
Showing
3 changed files
with
13 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
94 | ||
96 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters