Andrei Alexandrescu:

alias Algebraic!(string, Tuple!(string, This[])) Tree;

Needs a bugfix because of toString.

Filed:
http://d.puremagic.com/issues/show_bug.cgi?id=9580

Once issue 9580 is fixed it will allows a syntax:


import std.variant: Algebraic, This;
import std.typecons: tuple, Tuple;

alias Tree = Algebraic!(string, Tuple!(string, This[]));

void main() {
    import std.stdio;
    auto t = Tree("Sci-Fi",
      [tuple("No", Tree("Action",
                        [tuple("Yes", Tree("Stallone")),
                         tuple("No", Tree("Schwarzenegger"))])),
       tuple("Yes", Tree("Schwarzenegger"))]);

    writeln(t);
}


Thank you,
bye,
bearophile

Reply via email to