Boost logo

Boost :

From: Andy Glew (glew_at_[hidden])
Date: 1999-09-24 10:34:59


A whole slew of us are creating one-of idiosyncratic solutions.
This is why I would like to create a generic framework.

For example, if I understand the docs and code correctly,
your
    IntrusiveList<T>
works fine, so long as an object is on only one list.
The object has to inherit from ListNode<T>.
Trouble is, most interesting data structures have objects
on multiple lists simultaneously, and want to "cross over"
from one to the other. I call this a "multicontainer".

Previous solutions have accomplished this using multiple
inheritance - IMHO polluting the namespace by adding
intermediate classes for the different types of links an object
can be on.
        template<class T> class ListNode1<T> : ListNode<T> {}
        template<class T> class ListNode2<T> : ListNode<T> {}
        struct Data : ListNode1<T>, ListNode2<T> {}
Now Data can be on multiple lists...

I much prefer the pointer to member solution:
    IntrusiveList<class T, IntrusiveListLinkage T::*linkage>
Particularly if a default can be used (I haven't tried this).

I'd like to extend this to all STL containers, in the easiest possible
(least coding) way. Although I recognize that STL containers may
not be the optimal data structures for this sort of application, they
are something.

Valentin Bonnard wrote:

> > At this time I invite those of you who have in the past expressed
> > interest in such data structures to contact me, so that we can explore
> > the space of useful and convenient interfaces.
>
> See my IntrusiveList STL container, at:
>
> http://www.eleves.ens.fr:8080/home/bonnard/IntrusiveList/
>
> Summary: it's basically a std::list, except that each
> element has a back-link to the list. (So that
> list.front().get_container() is list.)
>
> --
>
> Valentin Bonnard
>
> ------------------------------------------------------------------------
>
> eGroups.com home: http://www.egroups.com/group/boost
> http://www.egroups.com - Simplifying group communications

--
---
Andy "Krazy" Glew, glew_at_[hidden], UW Madison and Intel.
DISCLAIMER: private posting, not representative of university or Intel.
Please respond by email in addition to replying to newsgroup.

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