where T is any literal type (not just int or other valid non-type template parameter types), but also double, or std::complex (from C++14 onward)
where fun() is any constexpr function
which is supported by std::make_integer_sequence from C++14 onward, but easily implemented today with both g++ and Clang (see Live Example at the end of the answer)
In C++14 it can be easily done with a constexpr constructor and a loop:
#include <iostream>
template<int N>
struct A {
constexpr A() : arr() {
for (auto i = 0; i != N; ++i)
arr[i] = i;
}
int arr[N];
};
int main() {
constexpr auto a = A<4>();
for (auto x : a.arr)
std::cout << x << '\n';
}