D24262: Modernize code: use range-based loops & algorithms in more places

David Faure noreply at phabricator.kde.org
Sun Sep 29 23:14:15 BST 2019


dfaure added inline comments.

INLINE COMMENTS

> kossebau wrote in browseropenorsavequestion.cpp:270
> In most projects I have seen people omitting the const, and only adding explicitly any &/* to help the human reader a bit more.
> If you prefer explicit const, fine with me, personally undecided how much auto is good :)

auto or not auto isn't the question when it comes to const :-)

Would you have written `foreach(QString &app, apps)` if `apps` was a qstringlist (to simplify)?
Or `for (QString &app : apps)` ?
You say "in most projects I have seen", but my reference is Qt, please find me one place in Qt where a range-for isn't using const when the item isn't modified inside the loop :)

And while * is redundant (therefore it only helps humans), the & is definitely not redundant. Without it you get a copy.

REPOSITORY
  R306 KParts

REVISION DETAIL
  https://phabricator.kde.org/D24262

To: kossebau, dfaure
Cc: ahmadsamir, dhaumann, 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/20190929/0c0fa31d/attachment.html>


More information about the Kde-frameworks-devel mailing list