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

Reply via email to