letting D generate functions that look alike

Saaa empty at needmail.com
Thu Mar 20 21:45:58 PDT 2008


Thanks,
I'll try this on my functions (and read up on templates. Never used those 
before.. exciting :)

>
>
> |int add(int inc)(int num){
> |  int i;
> |  i = num+inc;
> |  return i;
> |}
> |
> |add!(1)(val);
> |add!(2)(val);
>
> I have done functions with bool template parameters and then static if 
> inside. If you want clean names for them you can use aliases
>
> alias add!(1) add_1;
> alias add!(2) add_2;
>
> 




More information about the Digitalmars-d-learn mailing list