You can only use switch-case on types castable to an int.
You could, however, define a std::map<std::string, std::function> dispatcher
and use it like dispatcher[str]()
to achieve same effect.
You can only use switch-case on types castable to an int.
You could, however, define a std::map<std::string, std::function> dispatcher
and use it like dispatcher[str]()
to achieve same effect.