Lists Allowing for Switching Values
Jeroen Bollen
jbinero at gmail.com
Mon Feb 10 11:35:54 PST 2014
Is there a way in D to have a list that allows you to shift
around values? I'm creating a cache and I would like to keep a
log of when an item was last accessed so when the cache shrinks
or is about to overflow I can delete the items that haven't been
accessed in a while.
I would like to be able to push to the back and pop from the
front. Do note that I would like to pop from the front, and not
from the back, as I want the oldest items to be popped out.
I would like the be able to search if the item is actually in the
list. If no such functionality exists yet I could alternatively
implement it myself; it's not crucial.
I would like to be able to switch items around. This allows me
when an item already in the list is accessed, I can put it back
at the back, where the most recent items reside.
Does such a feature exist already in D, is there perhaps a better
approach about doing this?
More information about the Digitalmars-d
mailing list