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

David Faure noreply at phabricator.kde.org
Sat Sep 28 14:20:59 BST 2019


dfaure added inline comments.

INLINE COMMENTS

> kossebau wrote in plugin.cpp:196
> Do we have rules in KF whether stl-like names liks cbegin() & cend() are fine?
> Then plugins is const, so begin()/end() are giving use the const iterators already.
> 
> Does it make sense to catch the reference `library` by reference? Myself do not have a stable best-practice rules here, so happy to learn more.

STL is fine by definition, it's the C++ standard.

But yes, no need for cbegin/cend on a const container.

Catching `library` by reference makes sense, just like you wouldn't pass it by value to a function, here you're capturing it by value.

The fact that it's a reference in the argument list doesn't change anything. See e.g. http://www.cplusplus.com/forum/general/142165/

REPOSITORY
  R306 KParts

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

To: kossebau, dfaure
Cc: 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/20190928/dec86d9a/attachment.html>


More information about the Kde-frameworks-devel mailing list