[Issue 12597] Payload getter for std.typecons.Typedef
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Apr 24 03:58:47 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12597
--- Comment #9 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
Would this getter give ref access? If so, we might as well make the
`Typedef_payload` field public. Otherwise we could make a UFCS function that
would avoid symbol conflicts:
-----
V getValue(T)(T t)
/* if (isTypedef!T) */
{
return t.Typedef_payload;
}
-----
This would be usable via:
Typedef!Type x;
x.getValue(); // assuming 'Type' doesn't define getValue
getValue(x); // workaround if 'Type' *does* define getValue
Let me know what you think.
--
More information about the Digitalmars-d-bugs
mailing list