|
Boost : |
Subject: Re: [boost] [interprocess][multi_index] emplace() is not sufficient for maps
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-09-18 15:41:42
Thorsten Ottosen skrev:
> Hi Ion and JoaquÃn,
>
> This issue is related to node-based containers. I think you both have
> added emplace() to provide efficient in-place construction.
>
> However, I often encounter a situation where emplace() is not sufficient
> for me.
I actually got into a situation where I need another member function.
The issue arises when I use map/set as a priority_queue and want to
limit the size of the queue. In this situation I will be erasing one
element and inserting one element again and again. Unless the map/set
keeps a free-list of previously erased elements (which I don't think
they do normally) we will be deallocating and allocating a new node over
and over again.
Therefore I would like to see the follwing member:
iterator modify_key( const_iterator element, const Key& new_key );
This function only needs to rebalance/resort the keys and can completely
avoid deallocation/allocation.
Thoughts?
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk