Boost logo

Boost :

From: Olaf Krzikalla (krzikalla_at_[hidden])
Date: 2005-05-02 05:34:32


Thorsten Ottosen wrote:
> I see now that you always store the elements in a vector before you create a
> list of pointers; so that answers my question about where the
> stuff is stored.
Note, that the vector is used only as an example. Actually the elements
can be stored anywhere.

> Then I need to ask, what the big difference would be between your classes and
> using boost.multi-index container?
> Coulnd't the same functionality be found there already? If not, wouldn't it be
> easy to add the functionality there
> with a new style of indices.
Well, at a first glance it comes very close. You still need memory
management and copy-ctors, but besides this you can think of a

struct vertex { double x, y, z; };

typedef multi_index_container<vertex, /*sequences*/, pool_alloc>

being near the same as an vector of vetices including the nodes for
intrusive containers. But what really strikes me: it seems impossible to
have views with only subranges of the stored elements. That is, if you
look at the first figure in the Boost.Multiindex Tutorial, I couldn't
figure out how to get a sequenced view to e.g. the elements (1) and (2)
only. IMHO it's possible to add such functionality but it's by no way
easy (you'll need some sort of ref_counting internally). Hence, like
Boost.Intrusive Boost.Multiindex is a sequence approach, but for another
application area.

Best regards
Olaf Krzikalla

Boost list run by bdawes at, gregod at, cpdaniel at, john at