Here is simplified setup of my application:
class Engine {
void run(); { // main program loop
while (state != gameState::quit)
step<state>(); // ERROR
}
template<gameState>
void step() {} // empty default step function
template<>
void step<gameState::intro>() { /* do step for intro state*/ }
template<>
void step<gameState::menu>() { /* do step for menu state*/ }
gameState state;
}
What I want to do is call the step function dependant on the current value in state member. In step() call, the state isn't a constant expression which is a problem. Is there a way to write this enum dependant function call without some big ugly switch?
(This is only a simplified example with one function and only 2 states).