Is there a way to switch member variable initalization based on a template parameter?
Some enable_if trick or something similar?
I could do something like this with a lambda call
template<bool A>
struct Test{
static constexpr int a = [](){
if constexpr(A) return 1; else return 2;}();
};
but this fails for my actual use case with a look up array (also tried with std:array)
template<bool A>
struct Test{
// A==true variant
static constexpr std::int8_t table[4] {1,2,3,4};
// A==false variant
//static constexpr std::int8_t table[4] {4,6,7,3};
std::array.