www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21187] New: `.tupleof` should be directly usable as alias

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

          Issue ID: 21187
           Summary: `.tupleof` should be directly usable as alias
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

.tupleof solving generates a tuple for each use, so aliasing, without using an
AliasSeq, should work

---
struct F
{
    alias thisTup = typeof(this).tupleof;

    int a,b,c,d;

    void test()
    {
        static foreach (i; 0 .. 4)
            thisTup[i] = i + 1;
        assert(a == 1);
        assert(b == 2);
        assert(c == 3);
        assert(d == 4);
    }
}

void main()
{
    F().test();
}
---

--
Aug 21 2020