Why doesn't alias this work with arrays?

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Jun 18 09:51:01 PDT 2012


struct Wrap
{
    string wrap;
    alias wrap this;
}

void main()
{
    Wrap x;
    x = "foo";  // ok
    Wrap[] y = ["foo", "bar"];  // fail
}

Error: cannot implicitly convert expression (["foo","bar"]) of type
string[] to Wrap[]

Any special reason why this doesn't work? I hope it's just a bug or
unfinished implementation.


More information about the Digitalmars-d-learn mailing list