template alias = parameter

"Luís "Luís
Tue Sep 17 04:24:09 PDT 2013


Could you please comment on the following behaviors? Are all of 
them intended? Are they internally coherent, with respect to each 
  other?

1)
     void foo(alias f)(int f)
     {
         writeln(f);
     }

     foo(42);

     Error: does not match template

2)
     ...
     foo!(42)(42);

     > 42

3)
     ...
     foo!(7)(42);

     > 42

4)
     void foo(alias f)(int g=f)
     {
         writeln(g);
     }

     foo(42);

     Error: does not match template

5)
     void foo(alias f=42)(int g=f)
     {
         writeln(g);
     }

     foo();

     > 42


More information about the Digitalmars-d mailing list