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

Friedrich W. H. Kossebau noreply at phabricator.kde.org
Sun Sep 29 23:33:12 BST 2019


kossebau added inline comments.

INLINE COMMENTS

> dfaure wrote in browseropenorsavequestion.cpp:270
> 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.

Sigh... I learned C++ originally from the Stroustrup book, mostly reading in bed in leisure time. C++11 I learned from peers and the internet on the job, and now find myself often with misconceptions. I start to think I should return to proper books in bed :)
And seem references are a thing I tend to be wrong on, eh.

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/7870ac75/attachment.html>


More information about the Kde-frameworks-devel mailing list