Assume:
template<class T,int N>
struct A {
A(): /* here */ {}
T F[N];
};
I need the elements of F[]
to be constructed with {0,1,2,...,N-1}
. If possible I would like to avoid recursively defined template structs with defining the last level as template<class T> struct A<T,0>
and doing some complicated template tricks. Can C++11 initializer lists help?
This is similar Template array initialization with a list of values, but it does not construct the elements with the increasing value. It sets it later in a run-time loop.