param2 = param1

bearophile bearophileHUGS at lycos.com
Tue Aug 27 04:09:00 PDT 2013


Luís Marques:

> Is there a reason why template parameters can default to other 
> template parameters, but not regular parameters? For instance:
>
>     // OK
>     int foo(int x, int y = x)()
>     {
>         return x*y;
>     }
>
>     // Not OK
>     int foo(int x, int y = x)
>     {
>         return x*y;
>     }
>
> When I noticed this it seemed arbitrary, but maybe there's a 
> reason?

Do you have some use cases for this?

Bye,
bearophile


More information about the Digitalmars-d mailing list