Is there a way to define a variadic number of arguments of the same type?
问题 I can't figure out how to implement a function with a variable number of arguments of the same type. I'm writing for a microcontroller with little stack and memory, so I can't use recursion or the STL (the parts with exceptions). Is it possible to make such a function? struct S{ int r1; int r2; }; template<S* s, int... args> fun(int arg1, int arg2); which expands to something like this: for(int arg:args){ s->r1+=7*arg; } example of invocation: S s; const int mode=3, speed=1; fun<&s,1,2,7,4>