D12233: Avoid manipulation of lists with quadratic complexity
Stefan BrĂ¼ns
noreply at phabricator.kde.org
Fri Apr 20 12:44:28 UTC 2018
bruns requested changes to this revision.
bruns added inline comments.
This revision now requires changes to proceed.
INLINE COMMENTS
> jtamate wrote in pendingfilequeue.cpp:68
> According to std::partition <http://en.cppreference.com/w/cpp/algorithm/partition>
> what matches isDescendant should be from m_cache.begin() up to startRemoving, unless you want to remove what does not match isDescendant, isn't it?
Good catch, `std::remove_if` places the elements where the predicate returned `false` into the first "partition", `std::partition` shows the opposite behavior.
As we have to discard the second part (for O(1) behavior), the correct fix is to inverse the return value of the predicate.
Probably rename the the predicate to "preserveFile" or something like that.
REPOSITORY
R293 Baloo
REVISION DETAIL
https://phabricator.kde.org/D12233
To: michaelh, #baloo, bruns
Cc: jtamate, bruns, #frameworks, ashaposhnikov, michaelh, astippich, spoorun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180420/83818601/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list