Assign static constexpr class member to runtime variable
问题 I know there are a lot of similar questions, but somehow different questions. It is about the following situation: #include <iostream> #include <array> template<typename T> class MyClass { public: static constexpr std::array<T,4> ARRAY {{4, 3, 1, 5}}; }; int main() { constexpr std::array<int, 4> my_array(MyClass<int>::ARRAY); // works fine -> can use the ARRAY to initialize constexpr std::array constexpr int VALUE = 5*MyClass<int>::ARRAY[0]; // works also fine int value; value = my_array[0];