Boost logo

Boost :

Subject: Re: [boost] request for interest: stable vector
From: joaquin_at_[hidden]
Date: 2008-09-29 03:56:10


Emil Dotchevski escribió:
> On Sun, Sep 21, 2008 at 8:01 AM, Joaquin M Lopez Munoz <joaquin_at_[hidden]> wrote:
>
>> Hi Emil, as promised, some profile results are shown at:
>>
>> http://bannalia.blogspot.com/2008/09/profiling-stablevector.html
>>
>
> This is interesting, so basically the stable iterators/references are
> achieved by allocating each object in a separate node.
>
> This got me thinking, from certain point of view the difference
> between std::list and your stable_vector is the ability of the latter
> to return elements by index in O(1). Isn't it possible to decouple
> this ability from the container itself? In other words, could your
> code be refactored to provide indexing over any type of "host
> container"?
>

Well, sort of. Basically, that's what you can achieve by adding a random
access index
(http://tinyurl.com/4ruu2c ) to a multi_index_container.

> OTOH, I'm guessing that the only type of "host container" that would
> make sense is std::list, since the other "stable containers" don't
> preserve the ordering between the elements (which makes indexing
> impractical) so maybe it isn't worth the effort.
>

Indexing (as implemented by random access indices) is decoupled from
other indices:
you can have an element occupy position i-th in the random access index
and j-th in
other index, with i!=j.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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