I have a following function:
template<unsigned fromLine, unsigned toLine = fromLine>
void stateChanged()
{
// onStateChangeHandler[fromLine]();
if (fromLine < toLine)
stateChanged<fromLine + 1, toLine>();
}
which I call it in a following way:
stateChanged<0>();
stateChanged<1>();
stateChanged<2>();
stateChanged<3>();
stateChanged<4>();
stateChanged<5, 9>();
stateChanged<10, 15>();
I am receiving fatal error: template instantiation depth exceeds maximum of 900. I assumed in C++14 the if condition will stop it automatically. So, how to do this properly?