|
Boost : |
Subject: Re: [boost] [intrusive] recursive intrusive data structures
From: Tim Blechmann (tim_at_[hidden])
Date: 2010-06-14 13:08:18
>> 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_at_[hidden] http://tim.klingt.org Art is either a complaint or do something else John Cage quoting Jasper Johns
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk