On Wednesday, 7 January 2015 at 16:17:47 UTC, Tobias Pankrath wrote:
 A slice seems overkill to refer to just one object, but is that
the best way ?

struct Tree
{
    Tree[] children;
}

Is one way to do it.

You can add some nice sugar for this as well:

struct Tree
{
    this(string data, Tree[] children...)
    {
        this.data = data;
        this.children = children;
    }

    string data;
    Tree[] children;
}

http://dpaste.dzfl.pl/76a8a4c44345

Reply via email to