template alias = parameter

Dicebot public at dicebot.lv
Tue Sep 17 05:10:09 PDT 2013


On Tuesday, 17 September 2013 at 11:50:56 UTC, Luís Marques wrote:
> On Tuesday, 17 September 2013 at 11:46:07 UTC, Dicebot wrote:
>> It should not be possible as template instances with same 
>> template parameter list share same body in code gen.
>
> Well, my long shot idea was to use an alias template parameter, 
> that way different values would mean different template 
> parameters. But it seems I can't make the alias template 
> parameter implicitly match in any way.

Any two different alias parameter values mean different template 
instances. Static introspection demands it:

```
auto foo(alias T)()
{
     static if (is(typeof(T) : int) && (T == 42))
         return true;
     else
         return false;
}
```


More information about the Digitalmars-d mailing list