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

--- Comment #2 from Seb <greensunn...@gmail.com> ---
And a stripped down version of std.typecons.Tuple:

https://gist.github.com/wilzbach/0a55a571f1c46e9d59420cf158354b85

> A better implementation would be to have the Tuple with named fields use the 
> Tuple with no named fields as its only member variable; then, "alias this" 
> needs to simply return a reference to that member.

This is already done:


struct Tuple
{
   Types expand; // e.g. AliasSeq!(int, int)
}


However, if `alias expand this` is used, this stops to work:

---
auto t1 = Tuple!(int, "x", string, "y")(1, "a");
void foo(Tuple!(int, string) t2) {}
foo(t1);
---

foo.d(149): Error: function foo.__unittest_L143_C7.foo(Tuple!(int, string) t2)
is not callable using argument types (Tuple!(int, "x", string, "y"))
foo.d(149):        cannot pass argument t1 of type Tuple!(int, "x", string,
"y") to parameter Tuple!(int, string) t2

--

Reply via email to