Boost logo

Boost :

Subject: [boost] [intrusive] recursive intrusive data structures
From: Tim Blechmann (tim_at_[hidden])
Date: 2010-06-14 03:39:19


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;
};

i am currently using a base class as helper, which causes very dirty code,
since i explicitly need to cast from the base to the main class all over the
place:

struct my_node_base: boost::intrusive::list_base_hook<> {};

struct node: my_node_base
{
    boost::intrusive::list<my_node_base> children;
};

thanks, tim

-- 
tim_at_[hidden]
http://tim.klingt.org
Life is really simple, but we insist on making it complicated.
  Confucius

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