template alias = parameter

"Luís "Luís
Tue Sep 17 05:47:12 PDT 2013


On Tuesday, 17 September 2013 at 12:10:11 UTC, Dicebot wrote:
> 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;
> }
> ```

Yes, that's what I was saying (or trying? thanks anyway). The 
problem is that I can't get that and implicit instantiation at 
the same time.

I mean, if void foo(T)(T x) makes T=int when called with foo(42), 
I was hoping that maybe void foo(alias V)(int V) would make V=42. 
But no. Well, it was a long shot, but it was worth the try.


More information about the Digitalmars-d mailing list