
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; }
this doesn't: template <typename T> struct my_node: public boost::intrusive::list_base_hook<> { public: boost::intrusive::list<my_node<T> > children; }; int main() { boost::intrusive::list<my_node<int> > nodes; return 0; } instantiating an intrusive list outside of the specific class, the gcc complains: error: ‘my_node<T>::children’ has incomplete type any idea? thanks, tim -- tim@klingt.org http://tim.klingt.org Art is either a complaint or do something else John Cage quoting Jasper Johns