www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16166] New: struct constructor and AliasSeq

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 puremagic.com
          Reporter: kapblc 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);
}

--
Jun 11 2016