11 template <
typename ValType>
14 typedef list<ValType> LRU_List_t;
15 typedef map<ValType, typename LRU_List_t::iterator> LRU_Map_t;
17 const ValType& top()
const;
18 void push(
const ValType& value);
19 bool empty()
const {
return(internal_map.empty());}
20 size_t size()
const {
return(internal_map.size());}
23 LRU_Map_t internal_map;
24 LRU_List_t internal_list;
32 fprintf(stderr,
"Called top on empty LRU Queue!\n");
34 return(internal_list.front());
39 if (internal_map.find(value) != internal_map.end()) {
40 internal_list.erase(internal_map[value]);
42 internal_list.push_back(value);
43 internal_map[value] = prev(internal_list.end());
48 V val = internal_list.front();
49 internal_list.pop_front();
50 internal_map.erase(val);
Definition: LruQueue.hpp:12