D10288: [WIP, RFC] A different approach to reducing KFileItem copies

Mark Gaiser noreply at phabricator.kde.org
Sun Feb 4 14:13:20 GMT 2018


markg added inline comments.

INLINE COMMENTS

> dfaure wrote in dolphinview.cpp:1430
> This could just be const KFileItem &item = to avoid copying, no ?
>  (though maybe there's one copy inside the method implementation)

Then we're heading into (N)RVO and copy elision details, that's tricky. The function signature is:
KFileItem fileItem(int index) const

It has 2 return paths, 1 for returning the KFileItem if found and one for returning an empty one if nothing was found. There was something with multiple return paths, but i can't quite find what it was.
Also, copy elision talks about the same function return type (it's "KFileItem") as in the request side (which would be const KFileItem &) and is therefore not the same. Thus a copy is made.

This is a big assumption on my side. I'm not that familiar with these standard rules so i could very well be completely wrong.
So, ehh.. I don't know for sure but my guess is still a copy.

REPOSITORY
  R318 Dolphin

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

To: markg, dfaure
Cc: ngraham, #dolphin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180204/587df35d/attachment.htm>


More information about the kfm-devel mailing list