Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-01-05 09:48:36


David Abrahams wrote:
> Vladimir Prus <ghost_at_[hidden]> writes:
>
>
>>I'm in a need of a container, which:
>>
>>- is sorted
>>- has iterators which are not invalidated on
>> 'insert'
>>- keeps no more than k elements. If more elements are
>> inserted, the smallest ones should be erased.
>>
>>
>>I'm considering writing a wrapper over std::multiset for this purpose.
>>But before I start, I wanted to ask if anybody knows existing solution.
>
>
> If you don't really need iterator stability, and pointer/reference
> stability works instead, you might use a bounded heap of pointers to
> items stored in a deque.

After more thought, I believe that I can get along with priority queue
in which top is modifiable (e.g. which stores pointers). The only problem
is that I don't know any existing bounded priority queue/heap classes.
Those by Dietmar Kuehl are all unbounded.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk