D23902: [KCoreDirLister] replace deprecated foreach with range-for
David Faure
noreply at phabricator.kde.org
Tue Sep 17 23:53:15 BST 2019
dfaure added a comment.
Don't confuse the two rules of porting to range-for (for Qt containers)
1. The container should be const, to avoid paying for a detach. So either a local const var, or qAsConst() over a non-const var (but never a temporary returned by a function!)
2. The container should not be modified inside the loop. If it is, we'll get a crash. Much worse than a detach.
You need the qAsConst if the container isn't const, EVEN if it's not modified in the loop.
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D23902
To: ahmadsamir, kde-frameworks-devel, dfaure
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190917/26c03476/attachment.html>
More information about the Kde-frameworks-devel
mailing list