D26448: Add KRecentFilesMenu to replace KRecentFileAction

Nicolas Fella noreply at phabricator.kde.org
Tue Jan 7 20:02:52 GMT 2020


nicolasfella added inline comments.

INLINE COMMENTS

> dfaure wrote in krecentfilesmenu.cpp:85
> Why not std::vector?
> 
> std::list is a linked list, so this smells like pointers to nodes containing pointers, lots of indirection.

New entries are pushed to the front, which works in constant time for std::list and linear time for std::vector
When the maximum is reached the last element is removed which works in constant time for both.

We could turn it around and add new items to the back and iterate reverse, but then removing the front item would take linear time for std::vector

Given that n is small (<10 by default) it shouldn't matter much anyway

REPOSITORY
  R236 KWidgetsAddons

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

To: nicolasfella, #frameworks, dfaure
Cc: broulik, elvisangelaccio, cfeck, 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/20200107/96ad1cef/attachment.html>


More information about the Kde-frameworks-devel mailing list