alias this to a template function

Timon Gehr timon.gehr at gmx.ch
Sun Nov 11 15:18:18 PST 2012


On 11/11/2012 10:42 PM, Peter Alexander wrote:
> On Sunday, 11 November 2012 at 21:36:41 UTC, Adam D. Ruppe wrote:
>> I'm just curious if this is supposed to eventually work:
>
> How can the compiler possibly figure out what T is supposed to be?
>

Just how it figures out the parameter types of lambdas.
For example, defer the type checking, alias this lookup and template 
instantiation into the implicit conversion AST node.

> This will never work.

Maybe it wont.

> It doesn't even work without the alias this.
>
> void main() {
>      Test t;
>      int a = t.get(); // cannot deduce T
> }

Which only means it does not currently work.


More information about the Digitalmars-d mailing list