C++ Macro Arithmetric
- by anon
I have to do with Macros (it's macros calling macros; so templates are out of the question).
Here's what I want:
foo(3, a, b1, c1) --> foo1(a, b1, c1);
foo(5, a, b1, c1, b2, c2) -> foo2(a, b1, c1, b2, c2);
foo(7, a, b1, c1, b2, c2, b3, c3) -> foo3(a, b1, c1, b2, c2, b3, c3);
So basically, what I want is to be able to execute the "function" n - (n-1)/2 at macro expansion time. Is this possible?
Thanks!
[PS, if you dislike my questions; I support your right to downvote; my worst question so far is only -17, so maybe we can break that record; however, please let me know why my question is technically invalid.]
Thanks
EDIT:
Foo takes a variable # of arguments, of the form:
foo(N, a1, b1, a2, b2, ... a_N, b_N) -> foo##N(a1, b1, a2, b2, ... a_N, b_N);