Default Template Instantiation

Jonathan Marler via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 19 15:59:53 PDT 2016


On Monday, 19 September 2016 at 22:17:34 UTC, Mathias Lang wrote:
> 2016-09-19 23:18 GMT+02:00 Jonathan Marler via Digitalmars-d < 
> digitalmars-d at puremagic.com>:
>
>>[...]
>
> No you can't. The example is wrong, but Stefan is right. 
> Consider:
>
> ```
> template Foo (T = string) { }
>
> template TakesAlias(alias Sym) {}
>
> alias TakesAlias!(Foo) Bar;
> ```
>
> In this context, is `TakesAlias` instantiated with the template 
> or the template instantiation ?
>
> It is essentially the same category of problems as when trying 
> to use a parameterless-functions, sometime you end up calling 
> it because of the optional parenthesis. Except that for 
> functions we can use `&` or `typeof`.

Good example, thanks for the information.


More information about the Digitalmars-d mailing list