title: Free implementation of "bounded priority queue" in C++
body: <p>I'm looking for a free software implementation of the <em>bounded priority queue</em> abstraction in C++. Basically, I need a data structure that will behave just like <code>std::priority_queue</code> but will at all times hold the "best" <em>n</em> elements at most.</p>
  
  <p>Example:</p>
  
  <pre><code>std::vector&lt;int&gt; items; // many many input items
  bounded_priority_queue&lt;int&gt; smallest_items(5);
  for(vector&lt;int&gt;::const_iterator it=items.begin(); it!=items.end(); it++) {
    smallest_items.push(*it);
  }
  // now smallest_items holds the 5 smallest integers from the input vector
  </code></pre>
  
  <p>Does anyone know of a good implementation of such thing? Any experience with it?</p>