Too many if/else statements in converting user inputs to types in C++
问题 I have a template class with 3 template arguments. template <class T, class U, class Y> class MyClass {}; I wanna get input from users by CLI arguments, something like ./cli float driver-x load The first arg can be float or double The second arg is a driver name: driver-x , driver-y , ... The third argument is about the action type: load , unload , ... If I want to create a new instance of MyClass based on user inputs, I have to define many if/else statements. Because a user inputs are string