Tree datatype

2015-10-14 Thread Namal via Digitalmars-d-learn
Hello, I don't remember exactly but I think when I first saw D code there was tree datatype implemented without pointers. Is it possible to make a tree struct without pointers?

Re: Tree datatype

2015-10-14 Thread cym13 via Digitalmars-d-learn
On Wednesday, 14 October 2015 at 14:42:31 UTC, Namal wrote: Hello, I don't remember exactly but I think when I first saw D code there was tree datatype implemented without pointers. Is it possible to make a tree struct without pointers? If it is a binary tree, sure: just put your elements

Re: Tree datatype

2015-10-14 Thread Tobias Pankrath via Digitalmars-d-learn
On Wednesday, 14 October 2015 at 14:42:31 UTC, Namal wrote: Hello, I don't remember exactly but I think when I first saw D code there was tree datatype implemented without pointers. Is it possible to make a tree struct without pointers? struct Tree { Tree[] children; } That works quite

Re: Tree datatype

2015-10-14 Thread Meta via Digitalmars-d-learn
On Wednesday, 14 October 2015 at 14:42:31 UTC, Namal wrote: Hello, I don't remember exactly but I think when I first saw D code there was tree datatype implemented without pointers. Is it possible to make a tree struct without pointers? The answer is more or less no, unless you sort of fake

Re: Tree datatype

2015-10-14 Thread cym13 via Digitalmars-d-learn
On Wednesday, 14 October 2015 at 18:07:25 UTC, Meta wrote: The answer is more or less no, unless you sort of fake it like in cym13's example. A tree is not possible without pointers due to its recursive nature. Even if it looks like the implementation doesn't use pointers, they're just hidden

Re: Tree datatype

2015-10-14 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Oct 14, 2015 at 03:00:51PM +, Tobias Pankrath via Digitalmars-d-learn wrote: > On Wednesday, 14 October 2015 at 14:42:31 UTC, Namal wrote: > >Hello, > > > >I don't remember exactly but I think when I first saw D code there > >was tree datatype i