Priority queue and card

I am using LRU cache in my program. I have:

class DiadocCache : public IDiadocCache<K,T>
        {
        private:
             std::map<K, CacheEntry<T>> values_;
             std::priority_queue<?> timeQueue_;
        }

      

priority - the number of calls to the key in my case.

I am putting elements on std :: map like this: values_.insert (std :: make_pair (key, CacheEntry (value)));

How can I add elements to priority_queue? What types should be specified when creating a priority queue? std :: priority_queue <? >

+3


source to share


1 answer


LRU cannot be implemented with current DSs. you have to use a DLL with hashing of each item. you can use a list with unordered_hash or map. since in the current implementation you cannot update the priority_queue data.



0


source







All Articles