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

Friedrich W. H. Kossebau noreply at phabricator.kde.org
Sat Sep 28 14:49:58 BST 2019


kossebau added inline comments.

INLINE COMMENTS

> dfaure wrote in plugin.cpp:196
> 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/

Meh, I need to check quite some code of mine then, I got that wrong and thought that the values of the actual variables listed are captured (i.e. for a reference type the reference "pointer"), and not that some kind of interpretation happens here.
I unsure I understood the link (and other search hits I tried so far) and wonder, what actually is the type of `library` then in the lambda? A const reference, to a copy of the originally referenced object?

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


More information about the Kde-frameworks-devel mailing list