I have coded a class:
template<unsigned int N>
class WrappedUInt {
unsigned int m_value;
public:
// Many methods to imitate the unsigned integer type
// This class works as a interface (except for `N==0 || N==1`)
};
template<> class WrappedUInt<0> : public std::false_type {};
template<> class WrappedUInt<1> : public std::true_type {};
Then I have defined a variant type for an aplicattion:
using wuint_64_variant = std::variant<
WrappedUInt<0>,WrappedUInt<1>,WrappedUInt<2>,WrappedUInt<3>,WrappedUInt<4>,WrappedUInt<5>,
// to complete this large list with step 1
WrappeUInt<60>,WrappeUInt<61>,WrappeUInt<62>,WrappeUInt<63>
>;
Now I need functions for this variant type. I use a switch/case statement to work with this. It works very pretty with 2, 3, 4, ... , 63 distint cases in the statement.
I have read that the g++ compiler has limited the number of cases to 200, as clang++, MSVC and Intel compilers to 256, and the recomendation of standard is a minimum of 16384.
But gcc fails with more than 63 cases plus the default case, with the error 'File too big', why?
And other question is can I increment the number of cases permitted in a switch statement?