markg added a comment.
I unfortunately have no clue how to answer your questions. INLINE COMMENTS > kcoredirlister.cpp:825-829 > + // If take remove the element from the list. > + if (take) { > + dirItem->lstItems.erase(it); > + } > + return retKFileItem; Hmm, this looks weird to me. Sure, it works. "KFileItem retKFileItem = *it;" makes a copy. A more efficient way (but requires you to change the lists this is backed by to a std::vector) is to: 1. Take the element out of the vector. Something like "KFileItem item = std::move(*it); 2. Now the vector would be in a valid state but with one invalid object (will post a problem if you iterate over it later on) so you have to remove that element from the vector like you did. I'm not sure if the benefits of this justify the path of changing the list (dirItem->lstItems) to a std::vector, if possible at all. That's up to you :) REPOSITORY R241 KIO REVISION DETAIL https://phabricator.kde.org/D10742 To: jtamate, #frameworks, dfaure Cc: markg, michaelh