idiomatic D: what to use instead of pointers in constructing a tree data structure?

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 7 06:52:51 PST 2015


Another schoolboy question.

Suppose I am constructing a tree (in this case it is an AST).  In 
C I would have a pointer for the child to find the parent, and an 
array or linked list of pointers to find the children from the 
parent.

Obviously, I could still use pointers, but that would not be 
idiomatic.

I also could just use integer array index references.

A slice seems overkill to refer to just one object, but is that 
the best way ?


More information about the Digitalmars-d-learn mailing list