alias this to a template function
Jonathan M Davis
jmdavisProg at gmx.com
Sun Nov 11 14:24:48 PST 2012
On Sunday, November 11, 2012 22:36:40 Adam D. Ruppe wrote:
> I'm just curious if this is supposed to eventually work:
>
> struct Test {
> alias get this;
> T get(T)() {
> return T.init;
> }
> }
>
> void main() {
> Test t;
> int a = t;
> }
>
>
> Where the int a = t would be expanded to int a = t.get!int;
>
> The TDPL book says multiple alias this is supposed to be allowed,
> so you can subtype multiple things, but I'm wondering if we're
> eventually going to get the template to do multiple subtypes with
> one function.
You can only alias types and variables. A templated type isn't a type until
it's been fully instantiated.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list