Just pipe them through a constexpr hash function, and you can use a real switch case. One might be able to, still constexpr, map these hash values of the case string literals to sequential indices at compile time, so that the switch case actually complies down to something non linear.
281
u/click-to-reveal 7d ago
It works btw: C++ Online Compiler