title: How to implement a queue of unique ids where elements can be "bumped" to the top in C++?
body: <p>I am implementing a cache of elements (represented by unique ids), with a max number of elements to keep. Removing the last used element when I reach the max size. So it looks like a queue, but with unique elements, as I don't want to add multiple times the same id.</p>
  
  <p>But the elements can be used more than once and should go back to the top of the queue when they get used again, so that the cache really deletes the element that was used the last.</p>
  
  <p>I don't really know how to do this. My first guess is to use a std::list, so manage manually the uniqueness of the elements and the "move to the top" operation.<br>
  Is there any smarter way to achieve this?</p>
  
  <p>Edit: I did not know the name but this is more or less <a href="https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)" rel="nofollow noreferrer">Least recently used algorithms</a>.</p>