C++ `switch` statement replacement