I am programmatically generating bunch of functors, in order to keep the generated code more readable I am trying to come up with a macro that will expand line the following,
SET_STATE(FunctorA,a,b);
ref a;
ref b;
FunctorA(ref a, ref b){
this->a = a;
this->b = b;
}
Basically it will expand to the first arguments constructor. Variadic part is the number of arguments to the constructor. is it possible to loop inside the macro and generate this code during preprocessing even though it does not make sense for this particular case but I have some functors that have 20 or so variables that they have access to it will cleanup my generated code a lot.
All arguments will be of the same type, only names will differ.
See Question&Answers more detail:os