I want to create a template class with a member which is a constexpr array. The array needs, of course, a different initialization depending on the type it is but I cannot declare the array without initializing it. The problem is that I don't know the values of array until template specialization.
//A.hpp
template<typename T>
class A {
public:
static constexpr T a[];
constexpr A() {};
~A() {};
}
//B.hpp
class B: public A<int> {
public:
constexpr B();
~B();
};
//B.cpp
template<>
constexpr int A<int>::a[]={1,2,3,4,5};
B::B() {}
B::~B() {}
How can I properly initialize A::a[] in B?