
hi, i have a template function, the arguments of which i wish to have depend on a non-type int template argument: template<int n> double f<n>( double arg0, double arg1, ..., double argn ) // ... is not the variadic notation for var number of args { // for(int i=0; i<n; i++) // code return sum; } int main() { return x = f<3>( 1.0, 2.0, 3.0 ); } BOOST_PP_REPEAT can't seem to do the job as the template argument n needs to be known at the preprocessing stage, which happens before the template instantiation stage ( this is part of compilation) PS: I did some perf tests comparing inline f(double a0, double a1, double a2) calls in an intensive loop, vs inline f(double a[3]) // degenrates to pointer with intel compiler and max optim, and the top version is faster... regards,