Multiple Template Specialization Types (in D1)?

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Jul 1 20:18:30 PDT 2008


"Nick Sabalausky" <a at a.a> wrote in message 
news:g4ejen$10a$1 at digitalmars.com...

> Just for the hell of it, I tried changing all three "alias Foo_dwc(T) 
> Foo;" to "alias Foo_dwc!(T) Foo;" (ie, added "!"):
>
> ----- start test2.d -----
> public template Foo(T: char)  {alias Foo_dwc!(T) Foo; }
> public template Foo(T: wchar) {alias Foo_dwc!(T) Foo; }
> public template Foo(T: dchar) {alias Foo_dwc!(T) Foo; }
>
> private void Foo_dwc(T)(T arg) {  }
>
> void main(char[][] args)
> {
> Foo('a');
> }

Right, the bangs are necessary.

> ----- end test2.d -----
> ----- start compiler output: DMD win 1.029 -----
> test2.d(1): template test2.Foo(T : char) is not a function template
> test2.d(9): template test2.Foo(T : char) cannot deduce template function 
> from argument types (char)
> ----- end compiler output: DMD win 1.029 -----

And this is the sad outcome -- once you do this, Foo is no longer a function 
template, and so it can't have IFTI performed on it.  *sigh* 




More information about the Digitalmars-d-learn mailing list