I am porting some very old c-code in C ++, and I came across a linked list implemented in an array. The element is a simple structure:
struct element { void *m_ptrData; short m_nextEntry; short m_prevEntry; };
As an array, there is quick access to data if you know the index. An aspect of a linked list allows you to move items and βremoveβ them from the list. Items can be moved in the list by frequency of use (up for MRU and down for LRU).
I like to find a better way to implement this than using another array. I would like to use STL, but I'm not sure which container is best to use.
Anyone have any thoughts?
c ++ linked-list stl
kberson
source share