Boost logo

Boost :

Subject: Re: [boost] [intrusive] recursive intrusive data structures
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2010-06-14 11:50:37


On 14/06/2010 9:39, Tim Blechmann wrote:
> hi all,
>
> is there an easy way to define recursive data structures?
> something like:
>
> struct my_node: boost::intrusive::list_base_hook<>
> {
> boost::intrusive::list<my_node> children;
> };

This works on MSVC 7.1:

struct my_node : public boost::intrusive::list_base_hook<>
{
    public:
    boost::intrusive::list<my_node> children;
};

int main()
{
    my_node mnode;
    my_node mnode2;
    mnode.children.clear();
    mnode.children.insert(mnode.children.begin(), mnode2);
    return 0;
}

Best,

Ion


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