I was wondering if its possible to make the following answer more generic, in the sense that the type of the array be templated instead of just unsigned:
I\'ve enclosed
It helps if you indent the struct. The problem is that you are defining the data static member variable inside the Array struct. But it should be at namespace scope:
template
struct Array
{
template struct ArrayHolder {
static const ArrayType data[sizeof...(args)];
};
template class F, ArrayType... args>
struct generate_array_impl {
typedef typename generate_array_impl::value, args...>::result result;
};
template class F, ArrayType... args>
struct generate_array_impl<0, F, args...> {
typedef ArrayHolder::value, args...> result;
};
template class F>
struct generate_array {
typedef typename generate_array_impl::result result;
};
};
template template
const ArrayType Array::ArrayHolder::data[sizeof...(args)] = { args... };