[Issue 16166] New: struct constructor and AliasSeq

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jun 11 19:56:16 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16166

          Issue ID: 16166
           Summary: struct constructor and AliasSeq
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: kapblc at mail.ru

struct Window {
    string title;
    int x, y;
    int w, h;

    //this(T...)(T t){
    //    foreach(i, n; t) this.tupleof[i] = n;
    //}
}

alias seq(T...) = T;

void main(){
    Window a = seq!("Foo", 100, 100, 640, 480);
    // or
    import std.typecons;
    Window b = tuple("Foo", 100, 100, 640, 480).expand;

    writeln(a);
}

--


More information about the Digitalmars-d-bugs mailing list