letting D generate functions that look alike

Saaa empty at needmail.com
Thu Mar 20 21:14:40 PDT 2008


As the subject says, I would like D to generate functions from a template or 
something.

I have a (elaborate) function which I have to copy a few times with only 
minor changes.
I could make the function variadic, but this would be slower.
Can I let D create the functions for me?

The changes between the functions aren't complexer than:

int add_1(int num){
  int i;
  i=num+1;
  return i;
}

int add_2(int num){
  int i;
  i=num+2;
  return i;
}




More information about the Digitalmars-d-learn mailing list