D20489: [KIO] Make it compile without foreach (Step 1)
David Faure
noreply at phabricator.kde.org
Sun Apr 14 18:56:03 BST 2019
dfaure added a comment.
Yes, the pitfalls are well known.
1. don't modify the container being iterated upon (from inside the loop)
2. don't use qAsConst on temporaries
and for performance reasons, "don't use range-for over a non-const container", but that's of course not as bad as 1) and 2) which lead to crashes.
https://www.kdab.com/goodbye-q_foreach/ has a lot of details on point 2) in the comments.
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D20489
To: mlaurent, dfaure
Cc: cfeck, aacid, cgiboudeaux, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190414/26fbc1b6/attachment.html>
More information about the Kde-frameworks-devel
mailing list