D16601: Replace Q_FOREACH and foreach by the range based for statement
Denis Kurz
noreply at phabricator.kde.org
Thu Nov 1 21:54:48 GMT 2018
dkurz added a comment.
Replacing `Q_FOREACH` with range-based `for` actually might change performance, in case the data structure detaches. Basically, Q_FOREACH creates a const copy of the container and iterates over that, so no detaching happens.
Since you did not use a single `qAsConst`, you might be interested in https://www.kdab.com/goodbye-q_foreach/. OTOH, not using it is sometimes correct, e.g. if you iterate over an already const container or if you are extra careful that no detaching happens in the body (which might change in the future, though).
REPOSITORY
R76 PIM: Event Views
REVISION DETAIL
https://phabricator.kde.org/D16601
To: ognarb, #kde_pim
Cc: dkurz, kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20181101/48763bd4/attachment.html>
More information about the kde-pim
mailing list