Is it possible to write a variadic template class
template<typename Functor, int... D>
struct Foo
{
void bar()
{
// ???
}
};
Which is equivalent to
template<typename Functor, int D0>
struct Foo<Functor, D0>
{
void bar()
{
Functor f;
double d0[D0];
f(d0);
}
};
template<typename Functor, int D0, int D1>
struct Foo<Functor, D0, D1>
{
void bar()
{
Functor f;
double d0[D0];
double d1[D1];
f(d0, d1);
}
};
// And so on...
That is, the number of arguments to pass to the functor is equal to the number of template arguments. The arguments should be allocated on the stack.